1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
<TreeView x:Name="playlist" Grid.Row="1" ItemsSource="{Binding Playlist}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding file}">
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="Name" Text="{Binding Name}" Margin="0,0,10,0"/>
<Button Content="add" Command="{Binding Path=DataContext.Add_file, ElementName=playlist}"
CommandParameter="{Binding ElementName=Name, Path=Text}">
</Button>
</StackPanel>
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<TextBlock x:Name="File_name" Text="{Binding}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding Path=DataContext.Current_playlist, ElementName=playlist}"
CommandParameter="{Binding ElementName=Name,Path=Text}">
</i:InvokeCommandAction>
</i:EventTrigger>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding Path=DataContext.Lecture, ElementName=playlist}"
CommandParameter="{Binding ElementName=File_name,Path=Text}"></i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBlock>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView> |
Partager