private static void SourceProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e) { ControlTextGrid controlTextGrid = d as ControlTextGrid; ContentGrid controlGrid = e.NewValue as ContentGrid; if (controlTextGrid == null) { return; } if (controlGrid == null) { return; } controlTextGrid.RowCount = controlGrid.RowCount; controlTextGrid.ColumnCount = controlGrid.ColumnCount; controlTextGrid.BorderWidth = controlGrid.BorderWidth; ToolboxItem.DirectoryAssResInfo = new Dictionary <string, System.Collections.ObjectModel.ObservableCollection <string> >(); ToolboxItem.DirectoryTpage = new Dictionary <string, TPageControl>(); foreach (var v in controlGrid.List) { if (v.Content != null) { controlTextGrid.SetContent(v.Column, v.Row, v.Content); } if (v.Children != null) { controlTextGrid.SetContent(v.Column, v.Row, v.Children); } } }
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; } }
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; } }