WPF TreeView Binding

Source: Internet
Author: User
Tags bind bool

Bind Treeview in WPF

TreeView Xmal

   <treeview x:name= "Tvworkitem" grid.column= "0" grid.row= "2" background= "Black" itemssource= "{Bindi ng Menudatasource} "selecteditemchanged=" Treeview_onselecteditemchanged > <t Reeview.itemtemplate > <span style= "color: #ff0000;" >  

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

ViewModel

Private observablecollection<menuitem> _menudatasource;  
       Public observablecollection<menuitem> menudatasource  
       {  
           get  
           {  
               if (_menudatasource = null)  
                   _menudatasource = Menuoperation.loadmenu ();  
      
               return _menudatasource;  
           }  
           Set  
           {  
               _menudatasource = value;  
               raisePropertyChanged (() => menudatasource);  
           }  
       

Entity

 public class MenuItem {public Guid Id {get; set;}  
      public string Name {get; set;}  
      public string Oriname {get; set;}  
      public bool Hasoutstandingtask {get; set;} Public <span style= "color: #ff0000;"  
      >ObservableCollection<MenuItem></span> ChildItems {get; set;}  
      public bool Isworkitemtype {get; set;}  
      Public WorkItemType Worktype {get; set;}  
  public bool Isworkitem {get; set;} }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.