Reputation: 374
Lets say i have this rectangle with the name Rect
<Rectangle Name="Rect" Grid.ColumnSpan="2" Fill="#FF0099BB"/>
How can i get the Fill value of it, in code?
I tried
return Rect.Fill.ToString()
but all i got was the namespace and class and object of that control.
Upvotes: 1
Views: 145
Reputation: 6203
Try cast it to a SolidColorBrush;
var someBrash = Rect.Fill as SolidColorBrush;
if(someBrash != null)
someColor = brush.Color
Upvotes: 1