<Button x:Name="muthu" >
<Button.Template>
<ControlTemplate TargetType="Button">
<Rectangle x:Name="baserect" Fill="Black" Loaded="baserect_Loaded"/>
</ControlTemplate>
</Button.Template>
</Button>
We can get in backend by :
private Rectangle baserect;
private void baserect_Loaded(object sender, RoutedEventArgs e)
{
this.baserect = (Rectangle)sender;
}
2 comments:
You forgot to add Loaded event
Rectangle x:Name="baserect" Fill="Black" Loaded="baserect_Loaded"
But after I figured this out - your article was very useful.
Thanks
Thanks! I updated the blog with the missing code :)
Post a Comment