Beispiel #1
0
        private void MailRichTextFont(int FontProperty, object value)
        {
            TextSelection ts = MailRichText.Selection;

            if (ts != null)
            {
                if (FontProperty == 1)
                {
                    ts.ApplyPropertyValue(TextElement.FontWeightProperty, value);
                }
                else if (FontProperty == 2)
                {
                    ts.ApplyPropertyValue(TextElement.FontStyleProperty, value);
                }
                else if (FontProperty == 3)
                {
                    ts.ApplyPropertyValue(Inline.TextDecorationsProperty, value);
                }
                else if (FontProperty == 4)
                {
                    BrushConverter bc = new BrushConverter(); ts.ApplyPropertyValue(TextElement.ForegroundProperty, bc.ConvertFromString(value.ToString()));
                }
            }

            MailRichText.Focus();
        }
Beispiel #2
0
        public MailTextBox()
        {
            InitializeComponent();

            FontSizeCombobox.ItemsSource = new List <double>()
            {
                8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72
            };
            FontSizeCombobox.Text = FontSizeCombobox.Items[2].ToString();
            FontCombobox.Text     = FontCombobox.Items[2].ToString();

            FontCombobox.SelectionChanged += (s, e) =>
            {
                MailRichText.Selection.ApplyPropertyValue(TextElement.FontFamilyProperty, e.AddedItems[0]);
                MailRichText.Focus();
            };

            FontSizeCombobox.SelectionChanged += (s, e) =>
            {
                MailRichText.Selection.ApplyPropertyValue(TextElement.FontSizeProperty, e.AddedItems[0]);
                MailRichText.Focus();
            };
        }