From ab4e1e66d211f111e80919e1fca6311eda55e34c Mon Sep 17 00:00:00 2001 From: Aravindhanperiyasamy19 Date: Wed, 18 Jun 2025 15:44:29 +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 +- ...mand-Binding-and-Command-Target-Support.md | 190 ++++++++++-------- wpf/Menu/Getting-Started.md | 2 + 3 files changed, 122 insertions(+), 90 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/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/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)