private void PrepareRedlineInfo(FrameworkElement frameworkElement) { List <string> brushes = new List <string>(); foreach (var propertyInfo in frameworkElement.GetType().GetProperties()) { var propertyValue = propertyInfo.GetValue(frameworkElement); // Ignore hight contract brushes if (!propertyInfo.Name.StartsWith("FocusVisual") && propertyValue is Brush) { var brush = propertyValue as Brush; var colorProperty = brush.GetType().GetProperty("Color"); if (colorProperty != null) { if (_brushNameDict.ContainsKey(brush)) { string text = propertyInfo.Name + ": " + BrushNameDictionary.GetShortName(_brushNameDict[brush]); brushes.Add(text); m_usedBrushes.Add(_brushNameDict[brush]); } } } } if (brushes.Count > 0) { DrawBoundingRectangle(frameworkElement); var t = frameworkElement.TransformToVisual(LayoutRoot); var transform = t.TransformPoint(new Point(0, 0)); var content = String.Join(", ", brushes); Point position = new Point(transform.X, transform.Y); RedLineInfo redlineInfo = new RedLineInfo(position, frameworkElement, content); redlineInfos.Add(redlineInfo); } }
private void OutputBrushColorTable() { List <string> brushes = new List <string>(); foreach (var brushName in m_usedBrushes) { var brush = App.Current.Resources[brushName] as SolidColorBrush; brushes.Add(BrushNameDictionary.GetShortName(brushName) + ": " + brush.Color.ToString()); } BrushTextBlock.Text = String.Join("\n", brushes); }