From 2b65a2593dd7f7ddc0a410f570934ac76a98895d Mon Sep 17 00:00:00 2001 From: Aravindhanperiyasamy19 Date: Tue, 17 Jun 2025 17:44:34 +0530 Subject: [PATCH] 964819-Check and change the code snippet misalignment, mistakes and errors in WPF tools controls UG --- wpf/Breadcrumb/Getting-Started.md | 20 +- wpf/Menu/Animation-Support.md | 62 ++-- wpf/Menu/Binding-and-DataTemplate-Support.md | 220 +++++++------ .../Check-Box-and-Radio-Button-Support.md | 74 ++--- ...mand-Binding-and-Command-Target-Support.md | 190 ++++++----- wpf/Menu/Customizing-Data-Templates.md | 41 +-- wpf/Menu/Data-Binding.md | 302 +++++------------- wpf/Menu/Getting-Started.md | 2 + wpf/Menu/Icon-Support.md | 63 ++-- wpf/Menu/InputGestureText-Support.md | 118 +++---- wpf/Menu/Orientation-Support.md | 127 +++----- wpf/Menu/Scroll-Support.md | 2 +- 12 files changed, 478 insertions(+), 743 deletions(-) diff --git a/wpf/Breadcrumb/Getting-Started.md b/wpf/Breadcrumb/Getting-Started.md index 3688492eed..6f8c9b3693 100644 --- a/wpf/Breadcrumb/Getting-Started.md +++ b/wpf/Breadcrumb/Getting-Started.md @@ -49,11 +49,11 @@ To add the control manually in XAML, follow the given steps: + x:Class="HierarchyNavigatorSample.MainWindow" + Title="HierarchyNavigator Sample" Height="350" Width="525"> - - + + {% endhighlight %} @@ -75,7 +75,7 @@ To add the control manually in C#, follow the given steps: {% tabs %} {% highlight C# %} using Syncfusion.Windows.Tools; -namespace HierarchicalNavigatorSample +namespace HierarchyNavigatorSample { /// /// Interaction logic for MainWindow.xaml @@ -85,10 +85,10 @@ namespace HierarchicalNavigatorSample public MainWindow() { InitializeComponent(); - //Creating an instance of HierarchicalNavigator control - HierarchicalNavigator hierarchicalNavigator = new HierarchicalNavigator(); - //Adding HierarchicalNavigator as window content - this.Content = hierarchicalNavigator; + //Creating an instance of HierarchyNavigator control + HierarchyNavigator hierarchyNavigator = new HierarchyNavigator(); + //Adding HierarchyNavigator as window content + this.Content = hierarchyNavigator; } } } @@ -97,7 +97,7 @@ namespace HierarchicalNavigatorSample {% endcapture %} {{ codesnippet2 | OrderList_Indent_Level_1 }} -![wpf hierarchical navigator control added by code](Getting-Started_images/wpf-hierarchy-navigator-control-added-manually.png) +![wpf hierarchy navigator control added by code](Getting-Started_images/wpf-hierarchy-navigator-control-added-manually.png) ## Add items using HierarchyNavigatorItem diff --git a/wpf/Menu/Animation-Support.md b/wpf/Menu/Animation-Support.md index 2284b0fb61..4d7a54da4a 100644 --- a/wpf/Menu/Animation-Support.md +++ b/wpf/Menu/Animation-Support.md @@ -23,48 +23,27 @@ If the PopUpAnimationType property is set to Fade, the submenu will open with fa {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + {% endhighlight %} @@ -73,7 +52,6 @@ If the PopUpAnimationType property is set to Fade, the submenu will open with fa The property for the Animation support is described in the following tabulation: -
diff --git a/wpf/Menu/Binding-and-DataTemplate-Support.md b/wpf/Menu/Binding-and-DataTemplate-Support.md index 84a311fb7c..f51786bc16 100644 --- a/wpf/Menu/Binding-and-DataTemplate-Support.md +++ b/wpf/Menu/Binding-and-DataTemplate-Support.md @@ -22,121 +22,145 @@ The data source can be bound to MenuItemAdv by using the ItemsSource property. W {% tabs %} {% highlight xaml %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - < {% endhighlight %} {% highlight C# %} - public class MenuList -{ - public int MenuID { get; set; } - public string Caption { get; set; } - public MenuList() { } - public MenuList(string capt, int id) - { - Caption = capt; - MenuID = id; - } - } - public class MenuListCollection : ObservableCollection - { - public MenuListCollection() - { - for (int i = 0; i < 5; i++) - { - this.Add(new MenuList() - { - MenuID = i, Caption = "Menu " + (i + 1).ToString() }); - } - } - } - public class ObjectModel - { - public ObjectModel(string myString1, params ObjectModel[] myItems) - { - myString = myString1; - ObservableCollection itemsObservableCollection = new ObservableCollection(); - foreach (var item in myItems) - { - itemsObservableCollection.Add(item); - } - Items = itemsObservableCollection; - } - public string myString { get; set; } - public ObservableCollection Items { get; set; }} - public class CustomItemSource : ObservableCollection - { - public CustomItemSource() - { - this.Add(new ObjectModel("User Interface Edition", - new ObjectModel("ASP.NET", new ObjectModel("Tools", - new ObjectModel("Menu"), new ObjectModel("Toolbar"), - new ObjectModel("RangeSlider")), new ObjectModel("Diagram"), - new ObjectModel("Gauge"), new ObjectModel("Chart")), - new ObjectModel("ASP.NET MVC"), new ObjectModel("Windows Forms"), - new ObjectModel("WPF", new ObjectModel("Tools", new - ObjectModel("Menu"), new ObjectModel("Toolbar"), new - ObjectModel("RangeSlider")), new ObjectModel("Diagram"), new - ObjectModel("Gauge"), new ObjectModel("Chart")), new - ObjectModel("Silverlight", new ObjectModel("Tools", new - ObjectModel("Menu"), new ObjectModel("Toolbar"), new - ObjectModel("RangeSlider")), new ObjectModel("Diagram"), new - ObjectModel("Gauge"), new ObjectModel("Chart")))); - this.Add(new ObjectModel("Reporting Edition", - new ObjectModel("Essential Reports"), new ObjectModel - ("Essential XlsIO"), new ObjectModel("Essential DocIO"), - new ObjectModel("Essential PDF"), new ObjectModel("Essential - Calculate"), new ObjectModel("Essential Grouping"))); - this.Add(new ObjectModel("Business Intelligence", - new ObjectModel("Essential BI Chart"), new ObjectModel - ("Essential BI Client"), new ObjectModel("Essential BI Grid"), - new ObjectModel("Essential BI Gauge"))); - } - } +{ + public int MenuID { get; set; } + public string Caption { get; set; } + + public MenuList() { } + + public MenuList(string capt, int id) + { + Caption = capt; + MenuID = id; + } +} + +public class MenuListCollection : ObservableCollection +{ + public MenuListCollection() + { + for (int i = 0; i < 5; i++) + { + this.Add(new MenuList + { + MenuID = i, + Caption = "Menu " + (i + 1).ToString() + }); + } + } +} + +public class ObjectModel +{ + public ObjectModel(string myString1, params ObjectModel[] myItems) + { + myString = myString1; + ObservableCollection itemsObservableCollection = new ObservableCollection(); + foreach (var item in myItems) + { + itemsObservableCollection.Add(item); + } + Items = itemsObservableCollection; + } + + public string myString { get; set; } + public ObservableCollection Items { get; set; } +} + +public class CustomItemSource : ObservableCollection +{ + public CustomItemSource() + { + this.Add(new ObjectModel("User Interface Edition", + new ObjectModel("ASP.NET", + new ObjectModel("Tools", + new ObjectModel("Menu"), + new ObjectModel("Toolbar"), + new ObjectModel("RangeSlider")), + new ObjectModel("Diagram"), + new ObjectModel("Gauge"), + new ObjectModel("Chart")), + new ObjectModel("ASP.NET MVC"), + new ObjectModel("Windows Forms"), + new ObjectModel("WPF", + new ObjectModel("Tools", + new ObjectModel("Menu"), + new ObjectModel("Toolbar"), + new ObjectModel("RangeSlider")), + new ObjectModel("Diagram"), + new ObjectModel("Gauge"), + new ObjectModel("Chart")), + new ObjectModel("Silverlight", + new ObjectModel("Tools", + new ObjectModel("Menu"), + new ObjectModel("Toolbar"), + new ObjectModel("RangeSlider")), + new ObjectModel("Diagram"), + new ObjectModel("Gauge"), + new ObjectModel("Chart")) + )); + + this.Add(new ObjectModel("Reporting Edition", + new ObjectModel("Essential Reports"), + new ObjectModel("Essential XlsIO"), + new ObjectModel("Essential DocIO"), + new ObjectModel("Essential PDF"), + new ObjectModel("Essential Calculate"), + new ObjectModel("Essential Grouping"))); + + this.Add(new ObjectModel("Business Intelligence", + new ObjectModel("Essential BI Chart"), + new ObjectModel("Essential BI Client"), + new ObjectModel("Essential BI Grid"), + new ObjectModel("Essential BI Gauge"))); + } +} + {% endhighlight %} {% endtabs %} - ![Adding menu items using data binding in WPF MenuAdv control](Binding-and-DataTemplate-Support_images/Binding-and-DataTemplate-Support_img1.png) - ![Adding hierarchical menu items using data template in WPF MenuAdv control ](Binding-and-DataTemplate-Support_images/Binding-and-DataTemplate-Support_img2.png) - ### Sample Link WPF Sample Browser-> Tools -> MenuAdv -> MenuAdv Demo diff --git a/wpf/Menu/Check-Box-and-Radio-Button-Support.md b/wpf/Menu/Check-Box-and-Radio-Button-Support.md index 49962739a8..2311f2cb12 100644 --- a/wpf/Menu/Check-Box-and-Radio-Button-Support.md +++ b/wpf/Menu/Check-Box-and-Radio-Button-Support.md @@ -21,51 +21,37 @@ If you set the CheckIcon property to RadioButton, then MenuItemAdv’s will be g {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + {% endhighlight %} diff --git a/wpf/Menu/Command-Binding-and-Command-Target-Support.md b/wpf/Menu/Command-Binding-and-Command-Target-Support.md index 210d414b53..8c6d0b3966 100644 --- a/wpf/Menu/Command-Binding-and-Command-Target-Support.md +++ b/wpf/Menu/Command-Binding-and-Command-Target-Support.md @@ -24,92 +24,122 @@ To use the Command Binding support in an application users have to create a Dele {% tabs %} {% highlight xaml %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - {% endhighlight %} {% highlight C# %} - public partial class MainPage : UserControl -{ - public MainPage() - { - InitializeComponent(); - } - private DelegateCommand myCommand; - public DelegateCommand MyCommand - { - get - { - if (myCommand == null) - { - myCommand = new DelegateCommand(ApplyTheme); - } - return myCommand; - } - } - private void ApplyTheme(object visualStyle) - { - SkinManager.SetVisualStyle(this,(Syncfusion.Windows.Controls.Theming.VisualStyle)(visualStyle)); - } - } - - - -public class DelegateCommand : ICommand - { - public event EventHandler CanExecuteChanged; - readonly Predicate _canExecute = null; - readonly Action _executeAction = null; - public DelegateCommand(Action executeAction, Predicate canExecute) - { - _executeAction = executeAction; - _canExecute = canExecute; - } - public DelegateCommand(Action executeAction) : this(executeAction, null) - { - _executeAction = executeAction; - } - public void UpdateCanExecute() - { - if (CanExecuteChanged != null) - CanExecuteChanged(this, new EventArgs()); - } - public bool CanExecute(object parameter) - { - return _canExecute == null || _canExecute(parameter); - } public void Execute(object parameter) - { - if (_executeAction != null) - _executeAction(parameter); - UpdateCanExecute(); - } - } +{ + public MainPage() + { + InitializeComponent(); + } + + private DelegateCommand myCommand; + + public DelegateCommand MyCommand + { + get + { + if (myCommand == null) + { + myCommand = new DelegateCommand(ApplyTheme); + } + return myCommand; + } + } + + private void ApplyTheme(object visualStyle) + { + SkinManager.SetVisualStyle(this, (Syncfusion.Windows.Controls.Theming.VisualStyle)(visualStyle)); + } +} + +public class DelegateCommand : ICommand +{ + public event EventHandler CanExecuteChanged; + + private readonly Predicate _canExecute; + private readonly Action _executeAction; + + public DelegateCommand(Action executeAction, Predicate canExecute) + { + _executeAction = executeAction; + _canExecute = canExecute; + } + + public DelegateCommand(Action executeAction) + : this(executeAction, null) + { + } + + public void UpdateCanExecute() + { + CanExecuteChanged?.Invoke(this, new EventArgs()); + } + + public bool CanExecute(object parameter) + { + return _canExecute == null || _canExecute(parameter); + } + + public void Execute(object parameter) + { + _executeAction?.Invoke(parameter); + UpdateCanExecute(); + } +} + {% endhighlight %} {% endtabs %} diff --git a/wpf/Menu/Customizing-Data-Templates.md b/wpf/Menu/Customizing-Data-Templates.md index d9b25707cb..841d0f1a99 100644 --- a/wpf/Menu/Customizing-Data-Templates.md +++ b/wpf/Menu/Customizing-Data-Templates.md @@ -17,35 +17,18 @@ You can customize how a business object is displayed as MenuItemAdv using ItemTe {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + diff --git a/wpf/Menu/Data-Binding.md b/wpf/Menu/Data-Binding.md index 39b6536353..53701e0019 100644 --- a/wpf/Menu/Data-Binding.md +++ b/wpf/Menu/Data-Binding.md @@ -19,189 +19,98 @@ The MenuAdv control also supports binding to objects. The following example show ~~~csharp - public class Model - - { - - public Model() - - { - - SubItems = new ObservableCollection(); - - } - - - - public string Header { get; set; } - - - - public ObservableCollection SubItems { get; set; } - - - - } - + public class Model + { + public Model() + { + SubItems = new ObservableCollection(); + } + public string Header { get; set; } + public ObservableCollection SubItems { get; set; } + } ~~~ - 2. Create a ViewModel class and initialize the items. ~~~csharp - public class ViewModel - - { - - public ViewModel() - - { - + public class ViewModel + { + public ViewModel() + { MenuItems = new ObservableCollection(); - PopulateData(); + } - } - - - - public ObservableCollection MenuItems { get; set; } - - - - private void PopulateData() - - { + public ObservableCollection MenuItems { get; set; } + private void PopulateData() + { Model product = new Model() { Header = "Products" }; - PopulateSubSubItems(product); + MenuItems.Add(product); + } - MenuItems.Add(product); - - } - - - - private void PopulateSubSubItems(Model 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); - - - - } - - } - - - + } + } ~~~ 3. Create a ViewModel instance and use it as DataContext for the root window. - ~~~xaml - - + - - + ~~~ 4. Now configure the ItemsSource and ItemTemplate of MenuAdv. - ~~~xaml - - - - + - - - - - - - - - - - + + + - - - - - - + + ~~~ @@ -220,94 +129,51 @@ An XML file can also be used as _ItemsSource_ for the MenuAdv control. The follo ~~~xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + ~~~ 2. Add XmlDataProvider for the above XML document. - - ~~~xaml - - + ~~~ @@ -316,36 +182,16 @@ An XML file can also be used as _ItemsSource_ for the MenuAdv control. The follo ~~~xaml - - - - + - - - - - - - - - - - - - - - + + + - - - - - - + + ~~~ - This will create the following MenuAdv control. ![Data-Binding_images2](Data-Binding_images/Data-Binding_img2.png) diff --git a/wpf/Menu/Getting-Started.md b/wpf/Menu/Getting-Started.md index e8db4c5017..7995ea635f 100644 --- a/wpf/Menu/Getting-Started.md +++ b/wpf/Menu/Getting-Started.md @@ -224,6 +224,7 @@ You can display image on left of the [MenuItemAdv](https://help.syncfusion.com/c {% endhighlight %} +{% highlight C# %} string path; path = Path.GetFullPath(@"../../" +"NewIcon.png"); @@ -272,6 +273,7 @@ menuAdv.Items.Add(Edit); menuAdv.Items.Add(View); menuAdv.Items.Add(Project); +{% endhighlight %} {% endtabs %} ![Icons in WPF MenuAdv](getting-started_images/wpf-menu-icons.png) diff --git a/wpf/Menu/Icon-Support.md b/wpf/Menu/Icon-Support.md index 2bf29f56c2..0aed64116c 100644 --- a/wpf/Menu/Icon-Support.md +++ b/wpf/Menu/Icon-Support.md @@ -21,50 +21,27 @@ The Icon support can be added to an application by using the Icon property of Me {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + {% endhighlight %} diff --git a/wpf/Menu/InputGestureText-Support.md b/wpf/Menu/InputGestureText-Support.md index 2855f11b37..257f9964d4 100644 --- a/wpf/Menu/InputGestureText-Support.md +++ b/wpf/Menu/InputGestureText-Support.md @@ -21,99 +21,57 @@ The value assigned by using the InputGestureText property will be displayed in M {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% endhighlight %} ![InputGestureText-Support_img1](InputGestureText-Support_images/InputGestureText-Support_img1.png) - ### Properties The property for the InputGestureText support is described in the following tabulation: -
diff --git a/wpf/Menu/Orientation-Support.md b/wpf/Menu/Orientation-Support.md index ec5e3f79c9..bfea058829 100644 --- a/wpf/Menu/Orientation-Support.md +++ b/wpf/Menu/Orientation-Support.md @@ -33,48 +33,27 @@ Users can add the Orientation support to MenuAdv used in the application as ment {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + {% endhighlight %} @@ -118,61 +97,33 @@ When the ExpandMode property is set to ExpandOnClick, you can open the submenu o {% highlight xaml %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - {% endhighlight %} - - ### Properties The property for the Expand Modes support is described in the following tabulation: -
diff --git a/wpf/Menu/Scroll-Support.md b/wpf/Menu/Scroll-Support.md index 560848c4c2..24d0933ea5 100644 --- a/wpf/Menu/Scroll-Support.md +++ b/wpf/Menu/Scroll-Support.md @@ -11,7 +11,7 @@ documentation: ug MenuAdv allows users to scroll through the submenu items so that all the items of the submenu are visible even if the submenu crosses the vertical boundary. The Scroll support can be enabled by setting the IsScrollEnabled property to true. If the IsScrollEnabled property is set to false, users will not be able to scroll through the submenu items and the items that cross the vertical boundary will not be visible. -![Scroll-Support_img1](Scroll-Support_images/Scroll-Support_img1.png)} +![Scroll-Support_img1](Scroll-Support_images/Scroll-Support_img1.png)