WPF窗体应用程序中DataGrid如何实现多语言

在WPF窗体应用程序中,我采用的XAML的方法实现多语言,下面是页面的代码,DataGrid的字段只认设置的默认语言,其中Label是可以实现语言切换的。请各位大虾不吝赐教,小弟在此谢过~
            <ComboBox Height="23" Name="comboBox1" Width="120" SelectionChanged="comboBox1_SelectionChanged" Margin="0,0,158,238">
                <ComboBoxItem Content="中文" />
                <ComboBoxItem Content="英文" />
            </ComboBox>
            <Label Content="{DynamicResource Label1}" Height="28" Name="label1" Margin="57,65,123,168" />
            <DataGrid x:Name="dg_view" IsReadOnly="True" AutoGenerateColumns="False" Margin="0,180,0,0">
            <DataGrid.Columns>
                <DataGridTextColumn  Header="{DynamicResource Language_no}" Binding="{Binding LANGUAGE_NO}"/>
                <DataGridTextColumn Header="{DynamicResource Language_name}" Binding="{Binding LANGUAGE_NAME}"/>
            </DataGrid.Columns>
        </DataGrid>

后台代码: try
                    {
                        langRd =
                            Application.LoadComponent(
                                     new Uri(@"Lang\zh-TW.xaml", UriKind.Relative))
                            as ResourceDictionary;
                    }
                    catch
                    {
                    }

                    if (langRd != null)
                    {
                        if (this.Resources.MergedDictionaries.Count > 0)
                        {
                            this.Resources.MergedDictionaries.Clear();
                        }
                        this.Resources.MergedDictionaries.Add(langRd);
                    }

慕的地10843
浏览 565回答 4
4回答

当年话下

最好是給個有DataGrid的Demo^_^
打开App,查看更多内容
随时随地看视频慕课网APP