Silverlight: Binding a child controls property to a property in a user control
- by Jeremy
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?