Reputation: 749
How can I draw a line in XAML using a System.Drawing.Color
? A solution without a converter would be nice.
XAML:
<Line
X1="10" Y1="10"
X2="20" Y2="10"
Stroke="{Binding Color}" StrokeThickness="4" />
Code:
System.Drawing.Color Color = System.Drawing.Color.Black;
Upvotes: 0
Views: 3356
Reputation: 12336
You need to bind a Brush to the Stroke property, in particular a SolidColorBrush, which accepts a color.
However, you need to convert from System.Drawing.Color to System.Windows.Media.Color, e.g. by passing the R, G, and B values to the FromRgb method.
Upvotes: 3