public SettingsWindow(MainWindowViewmodel owner, AppSettings data)
        {
            if (string.IsNullOrWhiteSpace(data.ListFontFamily))
            {
                data.ListFontFamily = FontNameToFontFamily.StrDefaultValue;
            }
            if (string.IsNullOrWhiteSpace(data.NoteFontFamily))
            {
                data.NoteFontFamily = FontNameToFontFamily.StrDefaultValue;
            }
            if (string.IsNullOrWhiteSpace(data.TitleFontFamily))
            {
                data.TitleFontFamily = FontNameToFontFamily.StrDefaultValue;
            }

            InitializeComponent();

            ownerVM     = owner;
            viewmodel   = new SettingsWindowViewmodel(owner.Owner, data.Clone());
            DataContext = viewmodel;
        }
示例#2
0
        public SettingsWindow(MainWindowViewmodel owner, AppSettings data)
        {
            if (string.IsNullOrWhiteSpace(data.ListFontFamily))
            {
                data.ListFontFamily = FontNameToFontFamily.StrDefaultValue;
            }
            if (string.IsNullOrWhiteSpace(data.NoteFontFamily))
            {
                data.NoteFontFamily = FontNameToFontFamily.StrDefaultValue;
            }
            if (string.IsNullOrWhiteSpace(data.TitleFontFamily))
            {
                data.TitleFontFamily = FontNameToFontFamily.StrDefaultValue;
            }

            InitializeComponent();

            // HACK: Set this binding in code - otherwise you can't see the underlying panel in the XAML designer
            AdvancedWarningGrid.SetBinding(UIElement.VisibilityProperty, nameof(SettingsWindowViewmodel.HideAdvancedVisibility));

            _ownerVM    = owner;
            _viewmodel  = new SettingsWindowViewmodel(owner.Owner, data.Clone());
            DataContext = _viewmodel;
        }