
How to bind color to textbox background wpf
By: a guest on
Feb 21st, 2012 | syntax:
None | size: 1.06 KB | hits: 11 | expires: Never
<TextBlock Width="Auto" Height="Auto"
Text="{Binding ConnectionType}"
Canvas.Left="{Binding LabelPosition.X}"
Canvas.Top="{Binding LabelPosition.Y}" Background="{Binding ParentCanvasColor}">
<TextBlock.RenderTransform>
<TranslateTransform X="5" Y="5"/>
</TextBlock.RenderTransform>
</TextBlock>
public Color ParentCanvasColor
{
get
{
if (parentCanvas != null && parentCanvas is DesignerCanvasNetDiag)
{
return Colors.Red;
}
return Colors.Transparent;
}
}
public SolidColorBrush ParentCanvasColor
{
get
{
if (parentCanvas != null && parentCanvas is DesignerCanvasNetDiag)
{
return new SolidColorBrush(Colors.Red);
}
return new SolidColorBrush(Colors.Transparent);
}
}