Set image runtime in VisualBrush with c#
actually I set an image took from the resources at designtime into the xaml file like this: <Button Click="btnLogin_Click" Name="btnLogin"> <StackPanel Orientation="Horizontal"> <Rectangle Width="20" Height="20" Name="recLogin"> <Rectangle.Resources> <SolidColorBrush x:Key="BlackBrush" Color="White" /> </Rectangle.Resources> <Rectangle.Fill> <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_user}" x:Name="brushLogin" /> </Rectangle.Fill> </Rectangle> <TextBlock Text=" login" Name="txbLogin" /> </StackPanel> </Button> and works fine. But (is a login button) I wish that when the user do