Beispiel #1
0
        private void HandleSelect(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem listBoxItem = sender as ListBoxItem;
            bool        flag        = listBoxItem != null;

            if (flag)
            {
                this.SelectedColor = (Color)listBoxItem.Content;
                this.SetColorHandler(this, SetForegroundEventArgs <Color> .SetColor(this.SelectedColor));
            }
        }
 /// <summary>
 /// 设置选中文本背景色
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FontBackgroundPicker_SetColorHandler(object sender, SetForegroundEventArgs <Color> e)
 {
     this.richTextBox.Selection.ApplyPropertyValue(Run.BackgroundProperty, new SolidColorBrush(e.NewValue));
 }