From 83e48336b2828e0e9a49cb47b109d4a652ae2307 Mon Sep 17 00:00:00 2001 From: Swetha Date: Wed, 8 Nov 2023 12:38:51 +0530 Subject: [PATCH] Updated Readme File --- README.md | 188 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46e761e..ba9c054 100644 --- a/README.md +++ b/README.md @@ -1 +1,187 @@ -**[View document in Syncfusion Xamarin Knowledge base](https://www.syncfusion.com/kb/12142/how-to-conditionally-hide-the-checkbox-in-xamarin-forms-treeview-sftreeview)** +# How to hide checkbox treeview xamarin +This section illustrate how to hide checkbox treeview xamarin. + +# Getting Started with Xamarin CheckBox (SfCheckBox) + +## Adding SfCheckBox reference +You can add SfCheckBox reference using one of the following methods: + +## Method 1: Adding SfCheckBox reference from nuget.org + +Syncfusion Xamarin components are available in nuget.org. To add SfCheckBox to your project, open the NuGet package manager in Visual Studio, search for Syncfusion.Xamarin.Buttons, and then install it. + +## Method 2: Adding SfCheckBox reference from toolbox + +Syncfusion also provides Xamarin Toolbox. Using this toolbox, you can drag the SfCheckBox control to the XAML page. It will automatically install the required NuGet packages and add the namespace to the page. To install Syncfusion Xamarin Toolbox, refer to Toolbox. + +## Method 3: Adding SfCheckBox assemblies manually from the installed location + +If you prefer to manually reference the assemblies instead referencing from NuGet, add the following assemblies in respective projects. + +# Create a Simple SfCheckBox +The Xamarin CheckBox (SfCheckBox) control is configured entirely in C# code or by using XAML markup. The following steps explain how to create a SfCheckBox and configure its elements. + +## Add namespace for referred assemblies + +**[XAML]** +``` +xmlns:syncfusion="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms" +``` +Refer SfCheckBox control with declared suffix name for Namespace + +**[XAML]** + +``` + + + + + + + +``` +# Hide checkbox treeview xamarin + +``` + + + + + + + + + + + + + +``` +**[C#]** + +``` + public class FileManagerViewModel + { + #region Fields + private ObservableCollection checkedItems; + #endregion + + #region Properties + public ObservableCollection CheckedItems + { + get { return checkedItems; } + set { this.checkedItems = value; } + } + public ObservableCollection Folders { get; set; } + #endregion + + #region Constructor + public FileManagerViewModel() + { + this.Folders = GetFiles(); + } + #endregion + + #region Methods + private ObservableCollection GetFiles() + { + var nodeImageInfo = new ObservableCollection(); + Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly; + + var drive1 = new Folder() { FileName = "C:Drive" }; + var drive2 = new Folder() { FileName = "D:Drive" }; + + var doc = new SubFolder() { FileName = "Documents" }; + var download = new SubFolder() { FileName = "Downloads" }; + var mp3 = new SubFolder() { FileName = "Music" }; + var pictures = new SubFolder() { FileName = "Pictures" }; + var video = new SubFolder() { FileName = "Videos" }; + + var pollution = new File() { FileName = "Environmental Pollution.docx" }; + var globalWarming = new File() { FileName = "Global Warming.ppt" }; + + var games = new File() { FileName = "Game.exe" }; + var tutorials = new File() { FileName = "Tutorials.zip" }; + var typeScript = new File() { FileName = "TypeScript.7z" }; + var uiGuide = new File() { FileName = "UI-Guide.pdf" }; + + var song = new File() { FileName = "Gouttes" }; + + var camera = new File() { FileName = "Camera Roll" }; + var stone = new File() { FileName = "Stone.jpg" }; + var wind = new File() { FileName = "Wind.jpg" }; + + var img0 = new SubFile() { FileName = "WIN_20160726_094117.JPG" }; + var img1 = new SubFile() { FileName = "WIN_20160726_094118.JPG" }; + + var video1 = new File() { FileName = "Naturals.mp4" }; + var video2 = new File() { FileName = "Wild.mpeg" }; + + doc.Files = new ObservableCollection + { + pollution, + globalWarming + }; + + download.Files = new ObservableCollection + { + games, + tutorials, + typeScript, + uiGuide, + camera + }; + + mp3.Files = new ObservableCollection + { + song + }; + + pictures.Files = new ObservableCollection + { + camera, + stone, + wind + }; + camera.SubFiles = new ObservableCollection + { + img0, + img1 + }; + + video.Files = new ObservableCollection + { + camera, + video1, + video2 + }; + + drive1.SubFolder = new ObservableCollection + { + doc, + download, + mp3 + }; + drive2.SubFolder = new ObservableCollection + { + pictures, + video + }; + nodeImageInfo.Add(drive1); + nodeImageInfo.Add(drive2); + + checkedItems = new ObservableCollection(); + checkedItems.Add(doc); + checkedItems.Add(typeScript); + checkedItems.Add(uiGuide); + checkedItems.Add(stone); + checkedItems.Add(wind); + checkedItems.Add(song); + + return nodeImageInfo; + + } + #endregion + } +```