另一种解决分组的方法就是将NavBarControl绑定到一个执行ICollectionView的source,并指定GroupDescriptions:
[C#] CollectionViewEmployees.GroupDescriptions.Add(new PropertyGroupDescription("Department"));
代码:C# | 版本:15.2.4
<dx:DXWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar" xmlns:local="clr-namespace:NavBarExample" x:Class="NavBarExample.MainWindow" dx:ThemeManager.ThemeName="Office2013" Icon="{dx:DXImage Image=NameManager_16x16.png}" Title="NavBarControl Example" Height="410" Width="525"> <Window.DataContext> <local:ViewModel/> </Window.DataContext> <Grid> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <dxn:NavBarControl ItemsSource="{Binding Employees}" GroupDescription="Department"> <dxn:NavBarControl.Resources> <Style TargetType="dxn:NavBarGroup"> <Setter Property="Header" Value="{Binding}"/> </Style> <Style TargetType="dxn:NavBarItem"> <Setter Property="Content" Value="{Binding Path=Name}"/> </Style> </dxn:NavBarControl.Resources> <dxn:NavBarControl.View> <dxn:ExplorerBarView/> </dxn:NavBarControl.View> </dxn:NavBarControl> <Border Background="LightBlue" Grid.Column="1"/> </Grid> </Grid> </dx:DXWindow>
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/610.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/610.html