I am trying to create button that locks and unlocks a textbox the button displays a locked icon when the textbox is disabled and an unlocked lock when the textbox is enabled.
I have done a bunch of reading and found the question on this site: WPF Change button background image when clicked
I took the answer and came up with this.
<Button Grid.Row="0" Command="{Binding ChangePnumTextState}" CommandParameter="{Binding ElementName=ButtonCanvas, Path=Source}">
<Canvas Name="ButtonCanvas">
<Canvas.Style>
<Style TargetType="{x:Type Canvas}">
<Style.Triggers>
<DataTrigger Binding="{ Binding IsPNumLocked}" Value="True">
<Setter Property="Source" Value="{StaticResource appbar_lock}" />
</DataTrigger>
<DataTrigger Binding="{ Binding IsPNumLocked}" Value="False">
<Setter Property="Source" Value="{StaticResource appbar_unlock}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Canvas.Style>
</Canvas>
</Button>
I have imported this batch of icons http://modernuiicons.com/ into xaml file that gets drawn when I need one
I have looked around just cant find any examples of how to do this with SVG and not an image
EDIT
Ok it was pointed out that SVG doesnt work with wpf I am probably just confusing names up heres an example of the code I have in a resource library that I am using to get the icons
<Canvas x:Key="appbar_3d_obj" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="40" Height="40" Canvas.Left="18" Canvas.Top="18" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 18,21.7037L 43.9259,18L 58,25.4074L 58,54.2963L 32.8148,58L 18,49.1111L 18,21.7037 Z "/>
</Canvas>
The error I am getting is the visual studio underline the Property in the Setters and states
"The member 'Source' is not recognized or is not accessible"