程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> 關於.NET >> WPF TreeView Binding

WPF TreeView Binding

編輯:關於.NET

Bind Treeview In WPF

TreeView Xmal

   <TreeView x:Name="TvWorkItem" Grid.Column="0" Grid.Row="2" Background="Black"
                  ItemsSource="{Binding MenuDataSource}" 
                  SelectedItemChanged="TreeView_OnSelectedItemChanged">  
      
            <TreeView.ItemTemplate >  
             <span style="color:#ff0000;">   <HierarchicalDataTemplate ItemsSource="{Binding ChildItems}">  
                    <TextBlock Text="{Binding Name}" Background="Black" >  
</span>                         <TextBlock.Style >  
        <Style TargetType="TextBlock">  
            <Style.Triggers>  
      
               <DataTrigger Binding="{Binding HasOutStandingTask}" Value="true">   
                   <Setter  
                           Property="Foreground" 
                           Value="DarkOrange"  />  
                   <Setter Property="FontSize" Value="16"></Setter>  
               </DataTrigger>  
                <DataTrigger Binding="{Binding HasOutStandingTask}" Value="false">   
                   <Setter  
                           Property="Foreground" 
                           Value="Aqua"  />  
               </DataTrigger>  
                      
            </Style.Triggers>  
        </Style>  
    </TextBlock.Style>  
      
                    </TextBlock>  
                </HierarchicalDataTemplate>  
            </TreeView.ItemTemplate>  
        </TreeView>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved