コード例 #1
0
        private static void ItemForegroundProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolboxItem item = d as ToolboxItem;

            if (null == item)
            {
                return;
            }

            switch (item.AssetType)
            {
            case AssetType.Topic:
                Topic.TopicControl topicControl = item.Content as Topic.TopicControl;
                if (topicControl == null)
                {
                    break;
                }
                topicControl.ItemForeground = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.TopicDrag:
                Control.ControlTopicDrag controlTopicDrag = item.Content as Control.ControlTopicDrag;
                if (controlTopicDrag == null)
                {
                    break;
                }
                controlTopicDrag.ItemForeground = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.TextGrid:
                jg.Editor.Library.Control.ControlTextGrid controlTextGrid = item.Content as jg.Editor.Library.Control.ControlTextGrid;
                if (controlTextGrid != null)
                {
                    controlTextGrid.TextForeground = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.Text:
                jg.Editor.Library.Control.ControlTextEditor text = item.Content as jg.Editor.Library.Control.ControlTextEditor;
                if (text != null)
                {
                    text.mainRTB.Selection.ApplyPropertyValue(Run.ForegroundProperty, (SolidColorBrush)e.NewValue);
                }
                break;

            case AssetType.Message:
                jg.Editor.Library.Control.ControlMessage message = item.Content as jg.Editor.Library.Control.ControlMessage;
                if (message != null)
                {
                    message.Foreground = (SolidColorBrush)e.NewValue;
                }
                break;
            }
        }
コード例 #2
0
        private static void ItemBackgroundProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolboxItem item = d as ToolboxItem;

            if (null == item)
            {
                return;
            }

            switch (item.AssetType)
            {
            case AssetType.Topic:
                Topic.TopicControl topicControl = item.Content as Topic.TopicControl;
                if (topicControl == null)
                {
                    break;
                }
                topicControl.Background = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.TopicDrag:
                Control.ControlTopicDrag controlTopicDrag = item.Content as Control.ControlTopicDrag;
                if (controlTopicDrag == null)
                {
                    break;
                }
                controlTopicDrag.ItemBackground = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.Text:
                ControlTextEditor rtb = item.Content as ControlTextEditor;
                if (rtb != null)
                {
                    rtb.Background = (SolidColorBrush)e.NewValue;
                    rtb.mainRTB.Document.Background = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.TextGrid:

                jg.Editor.Library.Control.ControlTextGrid controlTextGrid = item.Content as jg.Editor.Library.Control.ControlTextGrid;
                if (controlTextGrid != null)
                {
                    controlTextGrid.TextBackground = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.Message:
                jg.Editor.Library.Control.ControlMessage message = item.Content as jg.Editor.Library.Control.ControlMessage;
                if (message != null)
                {
                    message.Background = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.Line:
                jg.Editor.Library.Control.ControlLine controlLine = item.Content as jg.Editor.Library.Control.ControlLine;
                if (controlLine != null)
                {
                    controlLine.Background = (SolidColorBrush)e.NewValue;
                }
                break;
            }
        }