
Visual Basic (Declaration) | |
---|---|
Public Class LocalizationConverter Implements IMultiValueConverter |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As LocalizationConverter |
C# | |
---|---|
public class LocalizationConverter : IMultiValueConverter |
Delphi | |
---|---|
public class LocalizationConverter = class(IMultiValueConverter) |
JScript | |
---|---|
public class LocalizationConverter implements IMultiValueConverter |
Managed Extensions for C++ | |
---|---|
public __gc class LocalizationConverter : public IMultiValueConverter |
C++/CLI | |
---|---|
public ref class LocalizationConverter : public IMultiValueConverter |
LocalizationConverter implements IMultiValueConverter, which means it is designated for data binding with a MultiBinding declaration.
LocalizationConverter makes it easy to merge one or more dynamic values based on a templated string. For instance, consider a TextBlock that displays the status of a file upload control such as "Uploading 3 of 10 files". With MultiBinding and LocalizationConverter, you can easily display a localized resource using data binding, and have the resource updated automatically whenever one of the specified data binding property changes.
LocalizationConverter dispatches the given values in the following manner:
- The first value of the {Binding} represents the template text to be displayed in the declared property. The text may contain dynamic placeholders with each placeholder numbered starting from zero, such as "Uploading {0} of {1} files".
- The remaining values of the {Binding} will be used to replace the dynamic placeholders that is defined in the first value. In the above example, the second value replaces the {0} placeholder, while the third value replaces the {1} placeholder.
The following example shows how to define the LocalizationConverter and MultiBinding in XAML to achieve the example referred in the above description.
XAML | ![]() |
---|---|
<Intersoft:UXPage.Resources> <core:LocalizationConverter x:Key="LocalizationConverter"/> </Intersoft:UXPage.Resources> <TextBlock HorizontalAlignment="Center"> <core:BindingFramework.MultiBinding> <core:MultiBinding TargetProperty="Text" Converter="{StaticResource LocalizationConverter}"> <core:BindingCollection> <Binding Path="ProgressStatus" Source="{StaticResource UploadResource}"/> <core:RelativeBinding Path="TotalUploadingFiles" RelativeSourceMode="TemplatedParent" ParentType="UXFileUpload"/> <core:RelativeBinding Path="TotalFilesToUpload" RelativeSourceMode="TemplatedParent" ParentType="UXFileUpload"/> </core:BindingCollection> </core:MultiBinding> </core:BindingFramework.MultiBinding> </TextBlock> |
For more information about ClientUI Localization Manager, see Localization Overview.
Intersoft.Client.Framework.LocalizationConverter
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family