From aa0f050d811bc423c09309471053f69a12aadd00 Mon Sep 17 00:00:00 2001 From: Lakshminatarajan Date: Fri, 25 Jul 2025 00:36:35 +0530 Subject: [PATCH 1/3] Updated TreeView/getting-started.md --- MAUI/TreeView/getting-started.md | 142 +++++++++++++++---------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/MAUI/TreeView/getting-started.md b/MAUI/TreeView/getting-started.md index 41cc285fc6..6b75df4c09 100644 --- a/MAUI/TreeView/getting-started.md +++ b/MAUI/TreeView/getting-started.md @@ -256,7 +256,7 @@ using System; namespace GettingStarted { - public class MainPage : ContentPage + public partial class MainPage : ContentPage { public MainPage() { @@ -275,7 +275,7 @@ namespace GettingStarted var sanFrancisco = new TreeViewNode() { Content = "San Francisco" }; usa.ChildNodes.Add(newYork); usa.ChildNodes.Add(california); - California.ChildNodes.Add(sanFrancisco); + california.ChildNodes.Add(sanFrancisco); treeView.Nodes.Add(australia); treeView.Nodes.Add(usa); @@ -305,6 +305,8 @@ Create a simple data model as shown in the following code example, and save it a {% tabs %} {% highlight c# tabtitle="FileManager.cs" %} +using System.Collections.ObjectModel; +using System.ComponentModel; public class FileManager : INotifyPropertyChanged { private string itemName; @@ -317,7 +319,7 @@ public class FileManager : INotifyPropertyChanged set { subFiles = value; - RaisedOnPropertyChanged("SubFiles"); + RaisedOnPropertyChanged(nameof(SubFiles)); } } @@ -327,7 +329,7 @@ public class FileManager : INotifyPropertyChanged set { itemName = value; - RaisedOnPropertyChanged("ItemName"); + RaisedOnPropertyChanged(nameof(ItemName)); } } @@ -337,7 +339,7 @@ public class FileManager : INotifyPropertyChanged set { imageIcon = value; - RaisedOnPropertyChanged("ImageIcon"); + RaisedOnPropertyChanged(nameof(ImageIcon)); } } @@ -363,6 +365,7 @@ Create a model repository class with `ImageNodeInfo` collection property initial {% tabs %} {% highlight c# tabtitle="FileManagerViewModel.cs" %} +using System.Collections.ObjectModel; public class FileManagerViewModel { private ObservableCollection imageNodeInfo; @@ -421,7 +424,7 @@ public class FileManagerViewModel download.SubFiles = new ObservableCollection { tutorials, - TypeScript, + typeScript, uiGuide }; @@ -530,7 +533,7 @@ public class Folder : INotifyPropertyChanged set { files = value; - RaisedOnPropertyChanged("Files"); + RaisedOnPropertyChanged(nameof(Files)); } } @@ -540,7 +543,7 @@ public class Folder : INotifyPropertyChanged set { itemName = value; - RaisedOnPropertyChanged("ItemName"); + RaisedOnPropertyChanged(nameof(ItemName)); } } @@ -550,7 +553,7 @@ public class Folder : INotifyPropertyChanged set { imageIcon = value; - RaisedOnPropertyChanged("ImageIcon"); + RaisedOnPropertyChanged(nameof(ImageIcon)); } } @@ -581,7 +584,7 @@ public class File : INotifyPropertyChanged set { subFiles = value; - RaisedOnPropertyChanged("SubFiles"); + RaisedOnPropertyChanged(nameof(SubFiles)); } } @@ -591,7 +594,7 @@ public class File : INotifyPropertyChanged set { itemName = value; - RaisedOnPropertyChanged("ItemName"); + RaisedOnPropertyChanged(nameof(ItemName)); } } @@ -601,7 +604,7 @@ public class File : INotifyPropertyChanged set { imageIcon = value; - RaisedOnPropertyChanged("ImageIcon"); + RaisedOnPropertyChanged(nameof(ImageIcon)); } } @@ -631,7 +634,7 @@ public class SubFile : INotifyPropertyChanged set { itemName = value; - RaisedOnPropertyChanged("ItemName"); + RaisedOnPropertyChanged(nameof(ItemName)); } } @@ -641,7 +644,7 @@ public class SubFile : INotifyPropertyChanged set { imageIcon = value; - RaisedOnPropertyChanged("ImageIcon"); + RaisedOnPropertyChanged(nameof(ImageIcon)); } } @@ -717,7 +720,6 @@ public class FileManagerViewModel download.Files = new ObservableCollection { - games, tutorials, typeScript, uiGuide @@ -804,7 +806,7 @@ namespace GettingStarted treeView.ItemsSource = viewModel.Folders; var propertyDescriptor = new HierarchyPropertyDescriptors(); propertyDescriptor.Add(new Syncfusion.TreeView.Engine.HierarchyPropertyDescriptor() { TargetType = typeof(Folder), ChildPropertyName = "Files" }); - propertyDescriptor.Add(new Syncfusion.TreeView.Engine.HierarchyPropertyDescriptor() { TargetType = typeof(Files), ChildPropertyName = "SubFiles" }); + propertyDescriptor.Add(new Syncfusion.TreeView.Engine.HierarchyPropertyDescriptor() { TargetType = typeof(File), ChildPropertyName = "SubFiles" }); treeView.HierarchyPropertyDescriptors = propertyDescriptor; this.Content = treeView; } @@ -826,46 +828,46 @@ The following code example demonstrates how to customize your content view using - + - - - - - - - - + + + + + + + - + - + {% endhighlight %} @@ -876,38 +878,36 @@ namespace GettingStarted { public partial class MainPage : ContentPage { - InitializeComponent(); - - SfTreeView treeView = new SfTreeView(); - FileManagerViewModel viewModel = new FileManagerViewModel(); - treeView.ItemsSource = viewModel.ImageNodeInfo; - treeView.ChildPropertyName = "SubFiles"; - treeView.ItemTemplateContextType = ItemTemplateContextType.Node; - treeView.ItemTemplate = new DataTemplate(() => + public MainPage() { - HorizontalStackLayout stack = new HorizontalStackLayout(); - var imageIcon = new Image { WidthRequest = 24, HeightRequest = 24 }; - imageIcon.SetBinding(Image.SourceProperty, new Binding("Content.ImageIcon")); - var itemName = new Label { FontSize = 15, VerticalTextAlignment=TextAlignment.Center, Padding=5 }; - itemName.SetBinding(Label.TextProperty, new Binding("Content.ItemName")); - - stack.Children.Add(imageIcon); - stack.Children.Add(itemName); - - return stack; - }); + InitializeComponent(); - treeView.ExpanderTemplate = new DataTemplate(()=> - { - var grid = new Grid(); - var expanderIcon = new Image(); - expanderIcon.SetBinding(Image.SourceProperty, new Binding("IsExpanded")); - expanderIcon.SetBinding(Image.IsVisibleProperty, new Binding("HasChildNodes")); - grid.Children.Add(expanderIcon); - return grid; - }); + SfTreeView treeView = new SfTreeView(); + FileManagerViewModel viewModel = new FileManagerViewModel(); + treeView.ItemsSource = viewModel.ImageNodeInfo; + treeView.ChildPropertyName = "SubFiles"; + treeView.ItemTemplateContextType = ItemTemplateContextType.Node; + treeView.ItemTemplate = new DataTemplate(() => + { + HorizontalStackLayout stack = new HorizontalStackLayout(); + var imageIcon = new Image { WidthRequest = 24, HeightRequest = 24 }; + imageIcon.SetBinding(Image.SourceProperty, new Binding("Content.ImageIcon")); + var itemName = new Label { FontSize = 15, VerticalTextAlignment = TextAlignment.Center, Padding = 5 }; + itemName.SetBinding(Label.TextProperty, new Binding("Content.ItemName")); + + stack.Children.Add(imageIcon); + stack.Children.Add(itemName); + + return stack; + }); + + treeView.ExpanderTemplate = new DataTemplate(() => + { + return new Image() { Source = "expander.png" }; + }); - this.Content = treeView; + this.Content = treeView; + } } } From ac268e91f32bc518e379ce86868afdf78330218e Mon Sep 17 00:00:00 2001 From: Lakshminatarajan Date: Mon, 28 Jul 2025 13:18:04 +0530 Subject: [PATCH 2/3] Updated getting-started.md for chat and assistview. --- MAUI/AIAssistView/getting-started.md | 130 ++++++++-------- MAUI/Chat/getting-started.md | 216 ++++++++++++++------------- 2 files changed, 181 insertions(+), 165 deletions(-) diff --git a/MAUI/AIAssistView/getting-started.md b/MAUI/AIAssistView/getting-started.md index 9c369ca06d..3f5812c17f 100644 --- a/MAUI/AIAssistView/getting-started.md +++ b/MAUI/AIAssistView/getting-started.md @@ -333,86 +333,90 @@ Next, create a view model class and initialize the collection of [AssistItem](ht {% tabs %} {% highlight c# tabtitle="ViewModel.cs" %} +using Syncfusion.Maui.AIAssistView; +using System.Collections.ObjectModel; +using System.ComponentModel; - using Syncfusion.Maui.AIAssistView; - public class GettingStartedViewModel : INotifyPropertyChanged - { - /// - /// Collection of assistItem in a conversation. - /// - private ObservableCollection assistItems; +namespace GettingStarted.ViewModel; +public class GettingStartedViewModel : INotifyPropertyChanged +{ + /// + /// Collection of assistItem in a conversation. + /// + private ObservableCollection assistItems; - public GettingStartedViewModel() - { - this.assistItems = new ObservableCollection(); - this.GenerateAssistItems(); - } - /// - /// Gets or sets the collection of AssistItem of a conversation. - /// - public ObservableCollection AssistItems - { - get - { - return this.assistItems; - } + public GettingStartedViewModel() + { + this.assistItems = new ObservableCollection(); + this.GenerateAssistItems(); + } - set - { - this.assistItems = value; - } - } + /// + /// Gets or sets the collection of AssistItem of a conversation. + /// + public ObservableCollection AssistItems + { + get + { + return this.assistItems; + } - private async void GenerateAssistItems() - { + set + { + this.assistItems = value; + } + } + + private async void GenerateAssistItems() + { // Adding a request item AssistItem requestItem = new AssistItem() { - Text = "listening", + Text = "listening", IsRequested = true }; - + // Add the request item to the collection this.AssistItems.Add(requestItem); - + // Generating response item await GetResult(requestItem); - } - - private async Task GetResult(AssistItem requestItem) - { + } + + private async Task GetResult(AssistItem requestItem) + { await Task.Delay(1000).ConfigureAwait(true); - + AssistItem responseItem = new AssistItem() { - Text ="Types of Listening : For a good communication, it is not only enough to convey the information efficiently, but it also needs to include good listening skill. Common types of Listening are Active listening and Passive listening.", - IsRequested = false, + Text = "Types of Listening : For a good communication, it is not only enough to convey the information efficiently, but it also needs to include good listening skill. Common types of Listening are Active listening and Passive listening.", + IsRequested = false, }; - + // Add the response item to the collection this.AssistItems.Add(responseItem); - } + } - /// - /// Property changed handler. - /// - public event PropertyChangedEventHandler PropertyChanged; + /// + /// Property changed handler. + /// + public event PropertyChangedEventHandler PropertyChanged; - /// - /// Occurs when property is changed. - /// - /// changed property name - public void RaisePropertyChanged(string propName) - { - if (this.PropertyChanged != null) - { - this.PropertyChanged(this, new PropertyChangedEventArgs(propName)); - } - } + /// + /// Occurs when property is changed. + /// + /// changed property name + public void RaisePropertyChanged(string propName) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propName)); + } + } - } +} {% endhighlight %} {% endtabs %} @@ -443,18 +447,22 @@ To populate AI AssistView, bind the assist items in ViewModel to [AssistItems](h {% endhighlight %} -{% highlight c# hl_lines="8" %} - public partial class MainPage : ContentPage - { +{% highlight c# hl_lines="12" %} +using GettingStarted.ViewModel; +using Syncfusion.Maui.AIAssistView; + +namespace GettingStarted; +public partial class MainPage : ContentPage +{ public MainPage() { InitializeComponent(); SfAIAssistView aiAssistView = new SfAIAssistView(); GettingStartedViewModel viewModel = new GettingStartedViewModel(); - this.aiAssistView.AssistItems = viewModel.AssistItems; + aiAssistView.AssistItems = viewModel.AssistItems; this.Content = aiAssistView; } - } +} {% endhighlight %} {% endtabs %} diff --git a/MAUI/Chat/getting-started.md b/MAUI/Chat/getting-started.md index 0b0a79f10e..c28eddb1f6 100644 --- a/MAUI/Chat/getting-started.md +++ b/MAUI/Chat/getting-started.md @@ -111,110 +111,113 @@ Create a simple message collection as shown in the following code example in a n {% tabs %} {% highlight c# tabtitle="ViewModel.cs" %} +using System.Collections.ObjectModel; +using System.ComponentModel; +using Syncfusion.Maui.Chat; - using Syncfusion.Maui.Chat; - public class GettingStartedViewModel : INotifyPropertyChanged - { - /// - /// Collection of messages in a conversation. - /// - private ObservableCollection messages; +namespace GettingStarted.ViewModel; - /// - /// Current user of chat. - /// - private Author currentUser; +public class GettingStartedViewModel : INotifyPropertyChanged +{ + /// + /// Collection of messages in a conversation. + /// + private ObservableCollection messages; - public GettingStartedViewModel() - { - this.messages = new ObservableCollection(); - this.currentUser = new Author() { Name = "Nancy" }; - this.GenerateMessages(); - } + /// + /// Current user of chat. + /// + private Author currentUser; - /// - /// Gets or sets the collection of messages of a conversation. - /// - public ObservableCollection Messages - { - get - { - return this.messages; - } + public GettingStartedViewModel() + { + this.messages = new ObservableCollection(); + this.currentUser = new Author() { Name = "Nancy" }; + this.GenerateMessages(); + } - set - { - this.messages = value; - } - } + /// + /// Gets or sets the collection of messages of a conversation. + /// + public ObservableCollection Messages + { + get + { + return this.messages; + } - /// - /// Gets or sets the current user of the message. - /// - public Author CurrentUser - { - get - { - return this.currentUser; - } - set - { - this.currentUser = value; - RaisePropertyChanged("CurrentUser"); - } - } + set + { + this.messages = value; + } + } - /// - /// Property changed handler. - /// - public event PropertyChangedEventHandler PropertyChanged; + /// + /// Gets or sets the current user of the message. + /// + public Author CurrentUser + { + get + { + return this.currentUser; + } + set + { + this.currentUser = value; + RaisePropertyChanged("CurrentUser"); + } + } - /// - /// Occurs when property is changed. - /// - /// changed property name - public void RaisePropertyChanged(string propName) - { - if (this.PropertyChanged != null) - { - this.PropertyChanged(this, new PropertyChangedEventArgs(propName)); - } - } + /// + /// Property changed handler. + /// + public event PropertyChangedEventHandler PropertyChanged; - private void GenerateMessages() - { - this.messages.Add(new TextMessage() - { - Author = currentUser, - Text = "Hi guys, good morning! I'm very delighted to share with you the news that our team is going to launch a new mobile application.", - }); + /// + /// Occurs when property is changed. + /// + /// changed property name + public void RaisePropertyChanged(string propName) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propName)); + } + } - this.messages.Add(new TextMessage() - { - Author = new Author() { Name = "Andrea", Avatar = "Andrea.png" }, - Text = "Oh! That's great.", - }); + private void GenerateMessages() + { + this.messages.Add(new TextMessage() + { + Author = currentUser, + Text = "Hi guys, good morning! I'm very delighted to share with you the news that our team is going to launch a new mobile application.", + }); - this.messages.Add(new TextMessage() - { - Author = new Author() { Name = "Harrison", Avatar = "Harrison.png" }, - Text = "That is good news.", - }); + this.messages.Add(new TextMessage() + { + Author = new Author() { Name = "Andrea", Avatar = "Andrea.png" }, + Text = "Oh! That's great.", + }); - this.messages.Add(new TextMessage() - { - Author = new Author() { Name = "Margaret", Avatar = "Margaret.png" }, - Text = "Are we going to develop the app natively or hybrid?", - }); + this.messages.Add(new TextMessage() + { + Author = new Author() { Name = "Harrison", Avatar = "Harrison.png" }, + Text = "That is good news.", + }); - this.messages.Add(new TextMessage() - { - Author = currentUser, - Text = "We should develop this app in .NET MAUI, since it provides native experience and performance.\",", - }); - } - } + this.messages.Add(new TextMessage() + { + Author = new Author() { Name = "Margaret", Avatar = "Margaret.png" }, + Text = "Are we going to develop the app natively or hybrid?", + }); + this.messages.Add(new TextMessage() + { + Author = currentUser, + Text = "We should develop this app in .NET MAUI, since it provides native experience and performance.", + }); + } +} {% endhighlight %} {% endtabs %} @@ -234,31 +237,36 @@ To load the messages to SfChat, bind the message collection to the [Messages](ht x:Class="GettingStarted.MainPage"> - + - - + + {% endhighlight %} {% highlight c# %} - public partial class MainPage : ContentPage - { - public MainPage() - { - InitializeComponent(); +using GettingStarted.ViewModel; +using Syncfusion.Maui.Chat; + +namespace GettingStarted; + +public partial class MainPage : ContentPage +{ + public MainPage() + { + InitializeComponent(); SfChat sfChat = new SfChat(); - GettingStartedViewModel viewModel = new GettingStartedViewModel(); - this.sfChat.Messages = viewModel.Messages; - this.sfChat.CurrentUser = viewModel.CurrentUser; - this.Content = sfChat; - } - } + GettingStartedViewModel viewModel = new GettingStartedViewModel(); + sfChat.Messages = viewModel.Messages; + sfChat.CurrentUser = viewModel.CurrentUser; + this.Content = sfChat; + } +} {% endhighlight %} {% endtabs %} From 986f94fbd8342f5bedafd50539190922563686c3 Mon Sep 17 00:00:00 2001 From: Lakshminatarajan Date: Mon, 28 Jul 2025 13:27:33 +0530 Subject: [PATCH 3/3] Updated TreeView/getting-started.md --- MAUI/TreeView/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAUI/TreeView/getting-started.md b/MAUI/TreeView/getting-started.md index 6b75df4c09..7a6a9b51ed 100644 --- a/MAUI/TreeView/getting-started.md +++ b/MAUI/TreeView/getting-started.md @@ -824,7 +824,7 @@ N> By default, the binding context for each tree view item will be the data mode The following code example demonstrates how to customize your content view using the `ItemTemplate` and `ExpanderTemplate` property in both XAML and C#. {% tabs %} -{% highlight xaml hl_lines="13 35" %} +{% highlight xaml hl_lines="14 36" %} {% endhighlight %} -{% highlight c# hl_lines="14 28" %} +{% highlight c# hl_lines="16 30" %} using Syncfusion.Maui.TreeView; namespace GettingStarted