I have a list of view models which I am binding to a TreeView, however these view models are representing a 'file system' like data structure with 'files' and 'folders'. So in the item template on my view for the tree view I have an image which should represent either a folder or a file.
Here is My XAML:
<StackPanel Orientation="Horizontal">
<!-- Folder Icon -->
<Image Width="15" Height="15" Stretch="Fill" Source="\Resources\Folder.png"></Image>
<Grid>
<!-- Folder Name -->
<Label Content="{Binding Path=FolderName}">
<!-- Force Selection on Right Click -->
<ACB:CommandBehaviourCollection.Behaviours>
<ACB:BehaviourBinding Event="PreviewMouseRightButtonDown" Command="{Binding Path=MainModel.SelectTreeViewItem}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeViewItem}}}"></ACB:BehaviourBinding>
</ACB:CommandBehaviourCollection.Behaviours>
</Label>
<!-- Folder Name Editor -->
<StackPanel Name="FolderEditor" Orientation="Horizontal" Visibility="Collapsed">
<TextBox Text="{Binding Path=FolderName}" Width="130"></TextBox>
<Button Content="Ok" Command="{Binding Path=RenameFolder}" CommandParameter="{Binding ElementName=FolderEditor}"></Button>
</StackPanel>
</Grid>
</StackPanel>
So basically I want to know how to bind the source of the image object to my view models.
Thanks, Alex.