private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { IsVisibleChanged -= OnIsVisibleChanged; // This should work from XAML, but doesn't var fontFamilyBinding = new Binding("EditorFontFamily") { Source = DataContext, Mode = BindingMode.TwoWay }; FontCombo.SetBinding(FontComboBox.SelectedFontFamilyProperty, fontFamilyBinding); var fontSizeBinding = new Binding("EditorFontSize") { Source = DataContext, Mode = BindingMode.TwoWay }; FontCombo.SetBinding(FontComboBox.SelectedFontSizeProperty, fontSizeBinding); var encodingBinding = new Binding("EditorEncoding") { Source = DataContext, Mode = BindingMode.TwoWay }; EncodingComboBox.SetBinding(EncodingComboBox.SelectedEncodingProperty, encodingBinding); MarkdownEngine.IsEnabled = string.IsNullOrWhiteSpace(App.UserSettings.CustomMarkdownConverter); }
private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { IsVisibleChanged -= OnIsVisibleChanged; var fontFamilyBinding = new Binding("EditorFontFamily") { Source = DataContext, Mode = BindingMode.TwoWay }; FontCombo.SetBinding(FontComboBox.SelectedFontFamilyProperty, fontFamilyBinding); var fontSizeBinding = new Binding("EditorFontSize") { Source = DataContext, Mode = BindingMode.TwoWay }; FontCombo.SetBinding(FontComboBox.SelectedFontSizeProperty, fontSizeBinding); }
public DisplaySettings() { InitializeComponent(); DataContext = App.UserSettings; var fontFamilyBinding = new Binding("EditorFontFamily") { Source = DataContext, Mode = BindingMode.TwoWay }; FontCombo.SetBinding(FontComboBox.SelectedFontFamilyProperty, fontFamilyBinding); var fontSizeBinding = new Binding("EditorFontSize") { Source = DataContext, Mode = BindingMode.TwoWay }; FontCombo.SetBinding(FontComboBox.SelectedFontSizeProperty, fontSizeBinding); }