public Settings() { InitializeComponent(); if (GlobalFont != null) { this.FontFamily = GlobalFont; } vieModel_Settings = new VieModel_Settings(); this.DataContext = vieModel_Settings; vieModel_Settings.Reset(); //绑定事件 foreach (var item in CheckedBoxWrapPanel.Children.OfType <ToggleButton>().ToList()) { item.Click += AddToRename; } if (Properties.Settings.Default.SettingsIndex == 2) { TabControl.SelectedIndex = 0; } else { TabControl.SelectedIndex = Properties.Settings.Default.SettingsIndex; } }
public Settings() { InitializeComponent(); vieModel_Settings = new VieModel_Settings(); vieModel_Settings.Reset(); this.DataContext = vieModel_Settings; //绑定中文字体 foreach (FontFamily _f in Fonts.SystemFontFamilies) { LanguageSpecificStringDictionary _font = _f.FamilyNames; if (_font.ContainsKey(System.Windows.Markup.XmlLanguage.GetLanguage("zh-cn"))) { string _fontName = null; if (_font.TryGetValue(System.Windows.Markup.XmlLanguage.GetLanguage("zh-cn"), out _fontName)) { ComboBox_Ttile.Items.Add(_fontName); } } } bool IsMatch = false; foreach (var item in ComboBox_Ttile.Items) { if (Properties.Settings.Default.Font_Title_Family == item.ToString()) { ComboBox_Ttile.SelectedItem = item; IsMatch = true; break; } } if (!IsMatch) { ComboBox_Ttile.SelectedIndex = 0; } var childsps = MainGrid.Children.OfType <StackPanel>().ToList(); foreach (var item in childsps) { item.Visibility = Visibility.Hidden; } childsps[Properties.Settings.Default.SettingsIndex].Visibility = Visibility.Visible; var RadioButtons = RadioButtonStackPanel.Children.OfType <RadioButton>().ToList(); RadioButtons[Properties.Settings.Default.SettingsIndex].IsChecked = true; }
public Settings() { InitializeComponent(); vieModel_Settings = new VieModel_Settings(); this.DataContext = vieModel_Settings; vieModel_Settings.Reset(); //绑定中文字体 //foreach (FontFamily _f in Fonts.SystemFontFamilies) //{ // LanguageSpecificStringDictionary _font = _f.FamilyNames; // if (_font.ContainsKey(System.Windows.Markup.XmlLanguage.GetLanguage("zh-cn"))) // { // string _fontName = null; // if (_font.TryGetValue(System.Windows.Markup.XmlLanguage.GetLanguage("zh-cn"), out _fontName)) // { // ComboBox_Ttile.Items.Add(_fontName); // } // } //} //bool IsMatch = false; //foreach (var item in ComboBox_Ttile.Items) //{ // if (Properties.Settings.Default.Font_Title_Family == item.ToString()) // { // ComboBox_Ttile.SelectedItem = item; // IsMatch = true; // break; // } //} //if (!IsMatch) ComboBox_Ttile.SelectedIndex = 0; //ServersDataGrid.ItemsSource = vieModel_Settings.Servers; //绑定事件 foreach (var item in CheckedBoxWrapPanel.Children.OfType<ToggleButton>().ToList()) { item.Click += AddToRename; } TabControl.SelectedIndex = Properties.Settings.Default.SettingsIndex; }