Silverlight: Binding a child controls property to a property in a user control
Posted
by Jeremy
on Stack Overflow
See other posts from Stack Overflow
or by Jeremy
Published on 2009-01-07T18:57:24Z
Indexed on
2010/03/27
3:33 UTC
Read the original article
Hit count: 363
Silverlight
|.NET
If I have a user control defined:
public partial class MainFooter : UserControl
{
public System.Windows.Media.Color BkColor;
}
and it's xaml:
<UserControl x:Class="Test.MainFooter">
<Grid x:Name="LayoutRoot">
<Rectangle x:Name="rctBottom_Background2"
HorizontalAlignment="Stretch"
Grid.Row="2">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.82,0.895" StartPoint="0.911,-0.442">
<GradientStop Color="{**How can I bind this to the BkColor property?}"/**>
<GradientStop Color="#00FFFFFF" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Grid>
</UserControl>
and used:
<MyControls:MainFooter x:Name="rcrMainFooter"
BkColor="#FFE2B42A">
</MyControls:MainFooter>
How would I go about binding the GradientStop Color in the Rectangle to the value of the it's user controls BkColor property?
© Stack Overflow or respective owner