/// <summary> /// Brushes to string. /// </summary> /// <param name="brush"> /// The brush. /// </param> /// <returns> /// brush type /// </returns> private static string BrushToString(Brush brush) { if (brush == null) { return ""; } var solidColorBrush = brush as SolidColorBrush; if (solidColorBrush != null) { return string.Format("SolidColorBrush: {0}", solidColorBrush.Color); } var imageBrush = brush as ImageBrush; if (imageBrush != null) { var bi = imageBrush.ImageSource as BitmapImage; if (bi != null) { return string.Format( "ImageBrush: {0}, UriSource: {1}", bi, bi.UriSource); } return string.Format("ImageBrush: {0}", imageBrush.ImageSource); } return brush.ToString(); }