Hello,
I am currently implementing a localization in our application. The headers of the columns and all captions of all controls are referenced to dynamic resources like that:
I am switching the culture during runtime with this function:
The column headers of the gridview are ignoring the dynamic resources. But the resources are correctly added to the MergedDictionaries-Collection. All other controls (RadControls too) are using the dynamic resources fine.
Do have any ideas what's going wrong with the columns?
I am currently implementing a localization in our application. The headers of the columns and all captions of all controls are referenced to dynamic resources like that:
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ArtikelNr}"
Header
=
"{DynamicResource ArtikelNr}"
IsReadOnly
=
"True"
/>
I am switching the culture during runtime with this function:
public
class
ResourceManager
{
public
static
void
SetResources(Collection<ResourceDictionary> collection, CultureInfo culture)
{
RemoveOld(collection);
try
{
Uri resource =
new
Uri(
"Resources/Strings_"
+ culture.Name +
".xaml"
, System.UriKind.Relative);
collection.Add(
new
ResourceDictionary { Source = resource });
}
catch
{
// TODO: Handle this, is it possible to be here?
}
}
private
static
void
RemoveOld(Collection<ResourceDictionary> collection)
{
for
(
int
i = 0; i < collection.Count; ++i)
{
if
(collection[i].Source.ToString().Contains(
"Strings_"
))
{
collection.RemoveAt(i);
--i;
}
}
}
public
static
List<CultureInfo> SupportedCultures
{
get
{
return
new
List<CultureInfo>()
{
new
CultureInfo(
"de-DE"
),
// DEU
new
CultureInfo(
"ru-RU"
),
// ENU
};
}
}
}
public
void
SetCulture(CultureInfo culture)
{
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
ResourceManager.SetResources(Resources.MergedDictionaries, culture);
}
The column headers of the gridview are ignoring the dynamic resources. But the resources are correctly added to the MergedDictionaries-Collection. All other controls (RadControls too) are using the dynamic resources fine.
Do have any ideas what's going wrong with the columns?