Localization binding

Sep 14, 2011 at 1:43 AM

Thanks for sharing this wonderful utility.

I am a new bee. I add a dependency property to the localization property to be truly localization

Here is what I have changed

 1. FiterOperatorLocalization

public class FilterOperatorLocalization: DependencyObject

{

 public FilterOperator Operator { get; set

; }

// I change this property 

 

public string Localization

 set { SetValue(LocalizationProperty, value 

); }    

}

 

 

public static readonly DependencyProperty LocalizationProperty = DependencyProperty.Register("Localization", typeof(string), typeof(FilterOperatorLocalization), null

);

 

public FilterOperatorLocalization()

{

}

}

}

2. SortDirectionLocalization

 

 

 

 

 

 

 

 

 

public class SortDirectionLocalization: DependencyObject

 

public ListSortDirection Direction { get; set; }

 

public string Localization

{

 

 

get { return (string)GetValue(LocalizationProperty); }

 

 

set { SetValue(LocalizationProperty, value);

 }

public static readonly DependencyProperty LocalizationProperty = DependencyProperty.Register("Localization", typeof(string), typeof(SortDirectionLocalization), null);

}

}

With the above changes, I can assign the value like this in xaml

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<UserControl.Resources

>

 

 

 

 

<riaDataFilter:FilterOperatorLocalizationCollection x:Key

="filterControlCollection">

 

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="Contains" Localization="{Binding ApplicationStrings.OperatorContain, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="EndsWith" Localization="{Binding ApplicationStrings.OperatorEndsWith, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsContainedIn" Localization="{Binding ApplicationStrings.OperatorIsContainedIn, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsEqualTo" Localization="{Binding ApplicationStrings.OperatorIsEqualTo, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsGreaterThan" Localization="{Binding ApplicationStrings.OperatorIsGreaterThan, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsGreaterThanOrEqualTo" Localization="{Binding ApplicationStrings.OperatorIsGreaterThanOrEqualTo, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsLessThan" Localization="{Binding ApplicationStrings.OperatorIsLessThan, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsLessThanOrEqualTo" Localization="{Binding ApplicationStrings.OperatorIsLessThanOrEqualTo, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="IsNotEqualTo" Localization="{Binding ApplicationStrings.OperatorIsNotEqualTo, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

<riaDataFilter:FilterOperatorLocalization Operator="StartsWith" Localization="{Binding ApplicationStrings.OperatorStartsWith, Source={StaticResource ResourceWrapper}}"

/>

 

 

 

 

</riaDataFilter:FilterOperatorLocalizationCollection

>

 

 

 

 

<riaDataFilter:SortDirectionLocalizationCollection x:Key

="sortControlCollection">

 

 

 

<riaDataFilter:SortDirectionLocalization Direction="Ascending" Localization="{Binding ApplicationStrings.SortAscending, Source={StaticResource ResourceWrapper

}}" />

 

 

 

<riaDataFilter:SortDirectionLocalization Direction="Descending" Localization="{Binding ApplicationStrings.SortDescending, Source={StaticResource ResourceWrapper

}}" />

 

 

 

</riaDataFilter:SortDirectionLocalizationCollection

>

 

 

 

 

</UserControl.Resources

>

 

 

 

 

{

 

 

{

 get { return (string

)GetValue(LocalizationProperty); }