2
Answers

Questions about C# templates and debugging

Photo of Moose Pickard

Moose Pickard

14y
1.9k
1
Hi

I have some questions.

I have hunch that there must be templates for C# Forms.
I mean most have the file, edit, window etc upper menus and are really similar.
Are there some sites like there are for HTML/CSS?
If you know any places then suggest them.


The other question is about debugging.
Guessing isn't really good here, one time I accidentally saw the objects inside a list.
I haven't found a way to reproduce this. 
Looked at the Object browser but there isn't any info about instanted objects, only about classes.
Any good material about debugging using the IDE is welcome.

Thanks

Answers (2)

1
Photo of Prakash Kumar
NA 1.6k 46.7k 8y
Refer this link,
 
http://www.c-sharpcorner.com/blogs/dynamic-menu-in-wpf122 
0
Photo of vipin kv
NA 200 0 8y
ViewModel
-------------------- 
public class MenuItemViewModel
{
public MenuItemViewModel()
{
this.MenuItems = new List<MenuItemViewModel>();
}
public string Text { get; set; }
public IList<MenuItemViewModel> MenuItems { get; private set; }
}
 
XAML Code
----------------------- 
<Window.Resources>
<HierarchicalDataTemplate DataType="{x:Type self:MenuItemViewModel}"
ItemsSource="{Binding Path=MenuItems}">
<ContentPresenter Content="{Binding Path=Text}" />
</HierarchicalDataTemplate>
</Window.Resources>
<DockPanel>
<Menu DockPanel.Dock="Top" ItemsSource="{Binding Path=MenuItems}" />
<Grid />
</DockPanel>