WPF Toolkit Datagrid 不在列上显示拆分器图标
对于 WPF 数据网格,我在 xaml 文件中使用以下代码行。我已将 datagrid 中列的 resize 属性设置为 true。它仍然没有在数据网格的列上显示拆分器图标。
<WPFToolkit:DataGrid CanUserAddRows="False" Background="GhostWhite"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
MouseDoubleClick="gridSearchClinet_MouseDoubleClick"
CanUserResizeColumns="True" CanUserReorderColumns="False"
Sorting="gridSearchClinet_Sorting" CanUserResizeRows="False"
ItemsSource="{Binding}" IsReadOnly="True"
CanUserSortColumns="True" CanUserDeleteRows="False"
x:Name="gridSearchClinet" AutoGenerateColumns="False"
Margin="10,65,11,50">
<WPFToolkit:DataGrid.RowStyle>
<Style TargetType="{x:Type WPFToolkit:DataGridRow}">
<Style.Triggers>
<Trigger Property="WPFToolkit:DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="LightBlue" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
</WPFToolkit:DataGrid.RowStyle>
<WPFToolkit:DataGrid.Columns>
<WPFToolkit:DataGridTextColumn Header="Division" Width="70"
CanUserResize="True" CanUserReorder="False"
CanUserSort="True" Binding="{Binding Spart}" />
<WPFToolkit:DataGridTemplateColumn Header="Description" CanUserResize="True"
Width="325" CanUserSort="True"
CanUserReorder="False"
SortMemberPath="Description">
<WPFToolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label HorizontalAlignment="Left" Width="1000"
VerticalAlignment="Center" BorderThickness="0"
Content="{Binding Path=Description}" FontSize="9"
ToolTip="{Binding Path=Description}" />
</DataTemplate>
</WPFToolkit:DataGridTemplateColumn.CellTemplate>
</WPFToolkit:DataGridTemplateColumn>
<WPFToolkit:DataGridTextColumn Header="PG" Width="50" CanUserResize="True"
CanUserReorder="False" CanUserSort="True"
Binding="{Binding Konda}" />
<WPFToolkit:DataGridTextColumn Header="BCC" Width="50" CanUserResize="True"
CanUserReorder="False" CanUserSort="True"
Binding="{Binding IhKomp}" />
<WPFToolkit:DataGridTemplateColumn Header="Booking Unit" CanUserResize="True"
Width="735" CanUserSort="True"
SortMemberPath="Beinh">
<WPFToolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label HorizontalAlignment="Left" Width="1000"
VerticalAlignment="Center" BorderThickness="0"
Content="{Binding Path=Beinh}" FontSize="9"
ToolTip="{Binding Path=Beinh}" />
</DataTemplate>
</WPFToolkit:DataGridTemplateColumn.CellTemplate>
</WPFToolkit:DataGridTemplateColumn>
</WPFToolkit:DataGrid.Columns>
</WPFToolkit:DataGrid>
非常感谢任何帮助。
For WPF datagrid I am using following lines of code in xaml file. I have set the resize property of columns in datagrid to true. Still it doesn't show splitter icon on columns of datagrid.
<WPFToolkit:DataGrid CanUserAddRows="False" Background="GhostWhite"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
MouseDoubleClick="gridSearchClinet_MouseDoubleClick"
CanUserResizeColumns="True" CanUserReorderColumns="False"
Sorting="gridSearchClinet_Sorting" CanUserResizeRows="False"
ItemsSource="{Binding}" IsReadOnly="True"
CanUserSortColumns="True" CanUserDeleteRows="False"
x:Name="gridSearchClinet" AutoGenerateColumns="False"
Margin="10,65,11,50">
<WPFToolkit:DataGrid.RowStyle>
<Style TargetType="{x:Type WPFToolkit:DataGridRow}">
<Style.Triggers>
<Trigger Property="WPFToolkit:DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="LightBlue" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
</WPFToolkit:DataGrid.RowStyle>
<WPFToolkit:DataGrid.Columns>
<WPFToolkit:DataGridTextColumn Header="Division" Width="70"
CanUserResize="True" CanUserReorder="False"
CanUserSort="True" Binding="{Binding Spart}" />
<WPFToolkit:DataGridTemplateColumn Header="Description" CanUserResize="True"
Width="325" CanUserSort="True"
CanUserReorder="False"
SortMemberPath="Description">
<WPFToolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label HorizontalAlignment="Left" Width="1000"
VerticalAlignment="Center" BorderThickness="0"
Content="{Binding Path=Description}" FontSize="9"
ToolTip="{Binding Path=Description}" />
</DataTemplate>
</WPFToolkit:DataGridTemplateColumn.CellTemplate>
</WPFToolkit:DataGridTemplateColumn>
<WPFToolkit:DataGridTextColumn Header="PG" Width="50" CanUserResize="True"
CanUserReorder="False" CanUserSort="True"
Binding="{Binding Konda}" />
<WPFToolkit:DataGridTextColumn Header="BCC" Width="50" CanUserResize="True"
CanUserReorder="False" CanUserSort="True"
Binding="{Binding IhKomp}" />
<WPFToolkit:DataGridTemplateColumn Header="Booking Unit" CanUserResize="True"
Width="735" CanUserSort="True"
SortMemberPath="Beinh">
<WPFToolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label HorizontalAlignment="Left" Width="1000"
VerticalAlignment="Center" BorderThickness="0"
Content="{Binding Path=Beinh}" FontSize="9"
ToolTip="{Binding Path=Beinh}" />
</DataTemplate>
</WPFToolkit:DataGridTemplateColumn.CellTemplate>
</WPFToolkit:DataGridTemplateColumn>
</WPFToolkit:DataGrid.Columns>
</WPFToolkit:DataGrid>
Any help is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论