private void Button_Click(object sender, RoutedEventArgs e)
        {
            FontChooserDialog dialog = new FontChooserDialog();

            dialog.Owner = Window.GetWindow(this);
            dialog.ShowDialog();
        }
Пример #2
0
        private void previewText_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            FontChooserDialog fcd = new FontChooserDialog();

            fcd.Owner = this;
            fcd.SelectFontSettings(previewText);

            fcd.ShowColor           = (bool)showColorCheckBox.IsChecked;
            fcd.ShowTextDecorations = (bool)showTextDecorationsCheckBox.IsChecked;

            if (fcd.ShowDialog() == true)
            {
                fcd.ApplyFontSettings(previewText);
            }
        }
        public bool?ShowDialog()
        {
            FontChooserDialog fontChooser = new FontChooserDialog();

            fontChooser.SelectedFontFamily = new System.Windows.Media.FontFamily(SelectedFontFamily);
            fontChooser.SelectedFontSize   = SelectedFontSize;
            fontChooser.SelectedFontColor  = ColorHelper.ToWpfColor(SelectedFontColor);

            fontChooser.ShowTextDecorations = false;
            fontChooser.Owner = App.Current.GetActiveWindow();

            var result = fontChooser.ShowDialog();

            if (result == true)
            {
                SelectedFontFamily = fontChooser.SelectedFontFamily.Source;
                SelectedFontSize   = fontChooser.SelectedFontSize;
                SelectedFontColor  = ColorHelper.FromWpfColor(fontChooser.SelectedFontColor);
            }

            return(result);
        }