From 1979168c87e548f12f69e2537e798514fc657267 Mon Sep 17 00:00:00 2001
From: SweathaBharathi <104504991+SweathaBharathi@users.noreply.github.com>
Date: Fri, 1 Aug 2025 12:42:58 +0530
Subject: [PATCH] Update README.md
README updated.
---
README.md | 236 +++++++++++++++++++++++++++---------------------------
1 file changed, 117 insertions(+), 119 deletions(-)
diff --git a/README.md b/README.md
index d0371f5..2428af4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# How to edit an item in WinUI Treeview?
+# How to edit an item in WinUI Treeview (SfTreeView)?
## About the sample
@@ -12,41 +12,40 @@ It is necessary to define [EditTemplate](https://help.syncfusion.com/cr/winui/Sy
``` XML
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
```
@@ -111,119 +110,118 @@ The user can take a backup of existing data of a node in the [BeginEdit](https:/
The below code snippet explains the simple implementation of IEditableObject interface to rollback the changes.
``` C#
-
public class EditingModel : INotifyPropertyChanged, IEditableObject
{
- #region Fields
+ #region Fields
- private string name;
- internal EditingModel backUpData;
- private EditingModel currentData;
+ private string name;
+ internal EditingModel backUpData;
+ private EditingModel currentData;
- private string header = string.Empty;
- private bool isexpanded = true;
- private DataTemplate imageTemplate;
- private ObservableCollection childs = null;
+ private string header = string.Empty;
+ private bool isexpanded = true;
+ private DataTemplate imageTemplate;
+ private ObservableCollection childs = null;
- #endregion
+ #endregion
- #region Constructor
+ #region Constructor
- public EditingModel()
- {
-
- }
+ public EditingModel()
+ {
- public EditingModel(string name):base()
- {
- Childs = new ObservableCollection();
- this.currentData = new EditingModel();
- this.currentData.name = name;
- }
+ }
- #endregion
+ public EditingModel(string name) : base()
+ {
+ Childs = new ObservableCollection();
+ this.currentData = new EditingModel();
+ this.currentData.name = name;
+ }
- #region Properties
- public string Header
+ #endregion
+
+ #region Properties
+ public string Header
+ {
+ get
+ {
+ return currentData.name;
+ }
+ set
{
- get
- {
- return currentData.name;
- }
- set
- {
- currentData.name = value;
- this.RaisePropertyChanged("Header");
- }
+ currentData.name = value;
+ this.RaisePropertyChanged("Header");
}
+ }
- public bool IsExpanded
+ public bool IsExpanded
+ {
+ get
{
- get
- {
- return isexpanded;
- }
- set
- {
- isexpanded = value;
- this.RaisePropertyChanged("IsExpanded");
- }
+ return isexpanded;
}
-
- public DataTemplate ImageTemplate
+ set
{
- get { return imageTemplate; }
- set { imageTemplate = value; }
+ isexpanded = value;
+ this.RaisePropertyChanged("IsExpanded");
}
+ }
- public ObservableCollection Childs
+ public DataTemplate ImageTemplate
+ {
+ get { return imageTemplate; }
+ set { imageTemplate = value; }
+ }
+
+ public ObservableCollection Childs
+ {
+ get
+ {
+ return childs;
+ }
+ set
{
- get
- {
- return childs;
- }
- set
- {
- childs = value;
- this.RaisePropertyChanged("Childs");
- }
+ childs = value;
+ this.RaisePropertyChanged("Childs");
}
+ }
- #endregion
+ #endregion
- #region INotifyPropertyChanged
+ #region INotifyPropertyChanged
- public event PropertyChangedEventHandler PropertyChanged;
+ public event PropertyChangedEventHandler PropertyChanged;
- public void RaisePropertyChanged(string _PropertyName)
+ public void RaisePropertyChanged(string _PropertyName)
+ {
+ if (PropertyChanged != null)
{
- if (PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(_PropertyName));
- }
+ PropertyChanged(this, new PropertyChangedEventArgs(_PropertyName));
}
+ }
- #endregion
+ #endregion
- #region IEditableObject
+ #region IEditableObject
- public void BeginEdit()
- {
- backUpData = new EditingModel();
- backUpData.name = this.currentData.name;
- }
-
- public void EndEdit()
- {
-
- }
+ public void BeginEdit()
+ {
+ backUpData = new EditingModel();
+ backUpData.name = this.currentData.name;
+ }
- public void CancelEdit()
- {
- this.currentData = backUpData;
- }
-
- #endregion
+ public void EndEdit()
+ {
+
+ }
+
+ public void CancelEdit()
+ {
+ this.currentData = backUpData;
+ }
+
+ #endregion
}
```