diff --git a/wpf/Menu/Binding-and-DataTemplate-Support.md b/wpf/Menu/Binding-and-DataTemplate-Support.md index ba9653ad7..8f3a93bc8 100644 --- a/wpf/Menu/Binding-and-DataTemplate-Support.md +++ b/wpf/Menu/Binding-and-DataTemplate-Support.md @@ -148,6 +148,7 @@ public class CustomItemSource : ObservableCollection new ObjectModel("Essential BI Gauge"))); } } + {% endhighlight %} {% endtabs %} diff --git a/wpf/Menu/Command-Binding-and-Command-Target-Support.md b/wpf/Menu/Command-Binding-and-Command-Target-Support.md index d71731b46..c7bb49d51 100644 --- a/wpf/Menu/Command-Binding-and-Command-Target-Support.md +++ b/wpf/Menu/Command-Binding-and-Command-Target-Support.md @@ -72,6 +72,7 @@ To use the Command Binding support in an application users have to create a Dele + {% endhighlight %} {% highlight C# %} diff --git a/wpf/Menu/Data-Binding.md b/wpf/Menu/Data-Binding.md index 0087d4440..2deb0194f 100644 --- a/wpf/Menu/Data-Binding.md +++ b/wpf/Menu/Data-Binding.md @@ -29,11 +29,10 @@ public class Model public string Header { get; set; } public ObservableCollection SubItems { get; set; } } - + {% endhighlight %} {% endtabs %} - 2. Create a ViewModel class and initialize the items. {% tabs %} @@ -41,65 +40,65 @@ public class Model public class ViewModel { - public ViewModel() - { - MenuItems = new ObservableCollection(); - PopulateData(); - } - - public ObservableCollection MenuItems { get; set; } - - private void PopulateData() - { - Model product = new Model() { Header = "Products" }; - PopulateSubSubItems(product); - MenuItems.Add(product); - } - - private void PopulateSubSubItems(Model product) - { - Model bi = new Model() { Header = "Business Intelligence" }; - Model ui = new Model() { Header = "User Interface" }; - Model wpf = new Model() { Header = "WPF" }; - Model tools = new Model() { Header = "Tools" }; - Model chart = new Model() { Header = "Chart" }; - Model grid = new Model() { Header = "Grid" }; - Model diagram = new Model() { Header = "Diagram" }; - Model gauge = new Model() { Header = "Gauge" }; - Model schedule = new Model() { Header = "Schedule" }; - Model edit = new Model() { Header = "Edit" }; - - wpf.SubItems.Add(tools); - wpf.SubItems.Add(chart); - wpf.SubItems.Add(grid); - wpf.SubItems.Add(diagram); - wpf.SubItems.Add(gauge); - wpf.SubItems.Add(schedule); - wpf.SubItems.Add(edit); - - Model sl = new Model() { Header = "Silverlight" }; - - ui.SubItems.Add(wpf); - ui.SubItems.Add(sl); - - Model reporting = new Model() { Header = "Reporting" }; - - product.SubItems.Add(bi); - product.SubItems.Add(ui); - product.SubItems.Add(reporting); - } + public ViewModel() + { + MenuItems = new ObservableCollection(); + PopulateData(); + } + public ObservableCollection MenuItems { get; set; } + + private void PopulateData() + { + Model product = new Model() { Header = "Products" }; + PopulateSubSubItems(product); + MenuItems.Add(product); + } + + private void PopulateSubSubItems(Model product) + { + Model bi = new Model() { Header = "Business Intelligence" }; + Model ui = new Model() { Header = "User Interface" }; + Model wpf = new Model() { Header = "WPF" }; + Model tools = new Model() { Header = "Tools" }; + Model chart = new Model() { Header = "Chart" }; + Model grid = new Model() { Header = "Grid" }; + Model diagram = new Model() { Header = "Diagram" }; + Model gauge = new Model() { Header = "Gauge" }; + Model schedule = new Model() { Header = "Schedule" }; + Model edit = new Model() { Header = "Edit" }; + + wpf.SubItems.Add(tools); + wpf.SubItems.Add(chart); + wpf.SubItems.Add(grid); + wpf.SubItems.Add(diagram); + wpf.SubItems.Add(gauge); + wpf.SubItems.Add(schedule); + wpf.SubItems.Add(edit); + + Model sl = new Model() { Header = "Silverlight" }; + + ui.SubItems.Add(wpf); + ui.SubItems.Add(sl); + + Model reporting = new Model() { Header = "Reporting" }; + + product.SubItems.Add(bi); + product.SubItems.Add(ui); + product.SubItems.Add(reporting); + } } {% endhighlight %} {% endtabs %} + 3. Create a ViewModel instance and use it as DataContext for the root window. {% tabs %} {% highlight xaml %} - + - + {% endhighlight %} @@ -111,16 +110,16 @@ public class ViewModel {% highlight xaml %} - - - - - + + + + + - + {% endhighlight %} {% endtabs %} - + Implementing the above code will generate the following control. ![Data-Binding_images1](Data-Binding_images/Data-Binding_img1.png) @@ -137,37 +136,40 @@ An XML file can also be used as _ItemsSource_ for the MenuAdv control. The follo {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% endhighlight %} {% endtabs %} @@ -175,13 +177,13 @@ An XML file can also be used as _ItemsSource_ for the MenuAdv control. The follo {% tabs %} {% highlight xaml %} - + - + x:Key="xmlSource" XPath="Categories"/> + {% endhighlight %} {% endtabs %} - + 3. Set ItemsSource property for the MenuAdv. @@ -189,16 +191,17 @@ An XML file can also be used as _ItemsSource_ for the MenuAdv control. The follo {% highlight xaml %} - - - - - - - + + + + + + + {% endhighlight %} {% endtabs %} + This will create the following MenuAdv control. ![Data-Binding_images2](Data-Binding_images/Data-Binding_img2.png) diff --git a/wpf/Menu/InputGestureText-Support.md b/wpf/Menu/InputGestureText-Support.md index b35bb21ba..257f9964d 100644 --- a/wpf/Menu/InputGestureText-Support.md +++ b/wpf/Menu/InputGestureText-Support.md @@ -61,6 +61,7 @@ The value assigned by using the InputGestureText property will be displayed in M + {% endhighlight %} ![InputGestureText-Support_img1](InputGestureText-Support_images/InputGestureText-Support_img1.png) diff --git a/wpf/Menu/Orientation-Support.md b/wpf/Menu/Orientation-Support.md index 6d48a20f4..10a5293fe 100644 --- a/wpf/Menu/Orientation-Support.md +++ b/wpf/Menu/Orientation-Support.md @@ -116,7 +116,6 @@ When the ExpandMode property is set to ExpandOnClick, you can open the submenu o - {% endhighlight %} ### Properties