WPF Toolkit Datagrid 不在列上显示拆分器图标

发布于 2024-12-02 17:49:50 字数 3839 浏览 1 评论 0原文

对于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文