TX Text Control .NET for WPF

ResourceProvider Class

Class|Introduced in 27.0
Namespace
TXTextControl.WPF
Package
TXTextControl.TextControl.WPF.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.WPF.dll
Install
dotnet add package TXTextControl.TextControl.WPF.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.WPF.dll from the setup.

Description

The ResourceProvider class provides static methods to receive bitmaps or strings from sources that can be accessed via an assigned identifier.

Syntax

public class ResourceProvider

Examples

The following examples shows how to create a System.Windows.Controls.Ribbon.RibbonSplitButton with the appearance of a ResourceProvider.FileMenuItem.TXITEM_Print button including two drop down items using the ResourceProvider class.

private void Window_Loaded(object sender, RoutedEventArgs e) {	
     // Get current Dpi value
     PresentationSource source = PresentationSource.FromVisual(this);
     double dpi = source.CompositionTarget.TransformToDevice.Transform(new Point(96.0, 96.0)).X;

     // Create large print ribbon split button
     RibbonSplitButton printButton = new RibbonSplitButton();
     printButton.LargeImageSource = ResourceProvider.GetLargeIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString(), dpi);
     printButton.SmallImageSource = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString(), dpi);
     printButton.Label = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());
     printButton.KeyTip = ResourceProvider.GetKeyTip(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());

     // Create two drop down buttons
     // 1. A Quick Print button
     RibbonMenuItem printDropDownItem = new RibbonMenuItem();
     printDropDownItem.ImageSource = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_PrintQuick.ToString(), dpi);
     printDropDownItem.Header = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_PrintQuick.ToString());
     printDropDownItem.ToolTipTitle = ResourceProvider.GetToolTipTitle(ResourceProvider.FileMenuItem.TXITEM_PrintQuick.ToString());
     printDropDownItem.ToolTipDescription = ResourceProvider.GetToolTipDescription(ResourceProvider.FileMenuItem.TXITEM_PrintQuick.ToString());
     printButton.Items.Add(printDropDownItem);

     // 2. A Print Preview Button
     printDropDownItem = new RibbonMenuItem();
     printDropDownItem.ImageSource = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString(), dpi);
     printDropDownItem.Header = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString());
     printDropDownItem.ToolTipTitle = ResourceProvider.GetToolTipTitle(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString());
     printDropDownItem.ToolTipDescription = ResourceProvider.GetToolTipDescription(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString());
     printButton.Items.Add(printDropDownItem);

     ribbonGroup.Items.Add(printButton);
}

The following example includes a Resource Provider object in application diagnostics. The created object is then available to the surrounding document workflow.

Console.WriteLine(resourceProvider);
Console.WriteLine("Resource Provider is ready for use.");

Members

Methods

MethodDescription
GetKeyTipGets the key tip that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the key tip resources. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture parameter, the returned key tip is based on the English resources.
GetLargeIconGets a System.Windows.Media.Imaging.BitmapSource of the large icon that is associated with an item and specified by an identifier or Scalable Vector Graphics (SVG) stream parameter. The identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). The size of the returned large icon depends on the resolution that is specified by the dpi parameter or a specific framework element. The source of the large image is based on a grid of 32x32 Pixel and a resolution of 96 dpi.
GetSmallIconGets a System.Windows.Media.Imaging.BitmapSource of the small icon that is associated with an item and specified by an identifier or Scalable Vector Graphics (SVG) stream parameter. The identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). The size of the returned small icon depends on the resolution that is specified by the dpi parameter or a specific framework element. The source of the small image is based on a grid of 16x16 Pixel and a resolution of 96 dpi.
GetTextGets the text that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the text resources. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture parameter, the returned text is based on the English resources.
GetToolTipDescriptionGets the tool tip description that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the tool tip description resources. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture paramter, the returned tool tip description is based on the English resources.
GetToolTipTitleGets the tool tip title that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the tool tip title. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture paramter, the returned tool tip title is based on the English resources.

Enumerations

EnumerationDescription
BarcodeItemEach BarcodeItem represents a drop-down item inside the RibbonInsertTab's TXITEM_Insert_Barcode drop-down menu. The string conversion of each BarcodeItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding drop-down item.
FileMenuItemEach FileMenuItem represents the identifier for a file menu item. The string conversion of each FileMenuItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding file menu item.
GeneralItemEach GeneralItem represents the identifier for a general item. The string conversion of each GeneralItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding general item.
ShapeItemEach ShapeItem represents a gallery item inside the RibbonInsertTab's TXITEM_InsertShape drop-down menu. The string conversion of each ShapeItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding gallery item.