This question is locked. New answers and comments are not allowed.
Hello to everybody...
I've got the following code :
That represent the items of this format :
And on the treeview's load I've :
It shows a treeview with a picture and a link for direct jump...
Now I need to add some chidren menu to an item and showing the "expand" button.... how can I achive this ? I think I've to add a children element of type MenuItem to the MenuItem Object, but I'm lost in the template format....
Thanks in advance
Paolo
I've got the following code :
| <Grid.Resources> |
| <core:HierarchicalDataTemplate x:Key="TopItem"> |
| <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Tag="{Binding FunctionName}"> |
| <Image Source="{Binding ImageURL}" Margin=" 0,0,6,0" /> |
| <HyperlinkButton x:Name="htmenuNavigation" Click="htmenuNavigation_Click" Tag="{Binding UserControl}" VerticalAlignment="Center"> |
| <TextBlock Text="{Binding Name}" Foreground="LightBlue" FontWeight="Bold" FontSize="15"/> |
| </HyperlinkButton> |
| </StackPanel> |
| </core:HierarchicalDataTemplate> |
| </Grid.Resources> |
That represent the items of this format :
| public class MenuItem |
| { |
| public string Name { get; set; } |
| public string ImageURL { get; set; } |
| public string UserControl { get; set; } |
| public string FunctionName { get; set; } |
| } |
And on the treeview's load I've :
| private void menuTreeView_Loaded(object sender, RoutedEventArgs e) |
| { |
| List<MenuItem> items = new List<MenuItem>(); |
| items.Add(new MenuItem { Name = "name1", ImageURL = "./Images/calendar.png", UserControl = "UC_1", FunctionName = "FUNCTION1" }); |
| items.Add(new MenuItem { Name = "name2", ImageURL = "./Images/search.png", UserControl = "UC_2", FunctionName = "FUNCTION2" }); |
| MenuItem item1= new MenuItem { Name = "name3", ImageURL = "./Images/contoterzi.png", UserControl = "UC_3", FunctionName = "FUNCTION3" }; |
| items.Add(item1); |
| menuTreeView.ItemsSource = items; |
| } |
It shows a treeview with a picture and a link for direct jump...
Now I need to add some chidren menu to an item and showing the "expand" button.... how can I achive this ? I think I've to add a children element of type MenuItem to the MenuItem Object, but I'm lost in the template format....
Thanks in advance
Paolo
