lang support for binding

This commit is contained in:
NaBian committed 2020-04-18 16:42:02 +08:00
1 parent 95f35c7366
commit 1680858455
20 files changed
+274 -117

No files matched your search

@@ -30,7 +30,7 @@
<TabControl SelectionChanged="TabControl_OnSelectionChanged" ItemContainerStyle="{StaticResource TabItemTransparent}" ItemsSource="{Binding DemoInfoList}" Style="{StaticResource TabControlInLine}" Background="Transparent" SelectedIndex="0">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Title}"/>
<TextBlock Text="{ex:Lang Key={Binding Title}}"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
@@ -51,7 +51,7 @@
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Source="{Binding ImageName}"/>
<TextBlock Margin="6,0,0,0" Text="{Binding Name}"/>
<TextBlock Margin="6,0,0,0" Text="{ex:Lang Key={Binding Name}}"/>
<Path Visibility="{Binding IsNew,Converter={StaticResource Boolean2VisibilityConverter}}" VerticalAlignment="Center" Data="{StaticResource NewGeometry}" Stretch="Uniform" Margin="10,0,0,0" Width="30" Height="14" Fill="{DynamicResource DangerBrush}"/>
</StackPanel>
</DataTemplate>
@@ -1,9 +1,8 @@
using System.Diagnostics;
using System.Globalization;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using HandyControl.Controls;
using HandyControl.Data;
using HandyControl.Tools;
using HandyControlDemo.Data;
using HandyControlDemo.Properties.Langs;
using HandyControlDemo.Window;
@@ -23,19 +22,11 @@ namespace HandyControlDemo.UserControl
{
PopupConfig.IsOpen = false;
if (tag.Equals(GlobalData.Config.Lang)) return;
Growl.Ask(Properties.Langs.Lang.ChangeLangAsk, b =>
{
if (!b) return true;
GlobalData.Config.Lang = tag;
GlobalData.Save();
ConfigHelper.Instance.SetLang(tag);
LangDecorator.Culture = new CultureInfo(tag);
LangDecorator.Culture = new CultureInfo(tag);
//var processModule = Process.GetCurrentProcess().MainModule;
//if (processModule != null)
// Process.Start(processModule.FileName);
//Application.Current.Shutdown();
return true;
});
GlobalData.Config.Lang = tag;
GlobalData.Save();
}
}