FontChooser
Inheritance: System.Windows.Window, System.Windows.Markup.IComponentConnector
Beispiel #1
0
        private void ShowFontDialog()
        {
            var fontChooser = new FontChooser {Owner = this};

            fontChooser.SetPropertiesFromObject(textBox);
            fontChooser.PreviewSampleText = textBox.SelectedText;

            var showDialog = fontChooser.ShowDialog();
            if (showDialog != null && showDialog.Value)
            {
                fontChooser.ApplyPropertiesToObject(textBox);
            }
        }
Beispiel #2
0
        private void ShowFontDialog()
        {
            var fontChooser = new FontChooser {
                Owner = this
            };

            fontChooser.SetPropertiesFromObject(textBox);
            fontChooser.PreviewSampleText = textBox.SelectedText;

            var showDialog = fontChooser.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                fontChooser.ApplyPropertiesToObject(textBox);
            }
        }
        private void ShowFontDialog()
        {
            var fontChooser = new FontChooser {
                Owner = this
            };

            fontChooser.SetPropertiesFromObject(textBox);
            fontChooser.PreviewSampleText = textBox.SelectedText;

            var showDialog = fontChooser.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                fontChooser.ApplyPropertiesToObject(textBox);

                typeface = new Typeface(fontChooser.SelectedFontFamily, fontChooser.SelectedFontStyle, fontChooser.SelectedFontWeight, fontChooser.SelectedFontStretch);
            }
        }
        private void ShowFontDialog(TextBox textBox)
        {
            var fontChooser = new FontChooser
            {
                Owner = this,
                PreviewSampleText = textBox.SelectedText
            };

            fontChooser.SetPropertiesFromObject(textBox);

            var result = fontChooser.ShowDialog();

            if (result == null || !result.Value)
            {
                return;
            }

            var fontDefinition = new FontDefinition();

            fontChooser.ApplyPropertiesToObject(textBox);
            fontChooser.ApplyPropertiesToObject(fontDefinition);

            textBox.Text = fontDefinition.ToString();
        }