3

スクロール時にグリッドの右側の列を固定する必要があります。他の場所では、SelectiveScrollingGrid を使用して左側の列をうまく固定していますが、固定された列が右側の場合は機能しなくなります。

ここにいくつかの XAML があります:

<!-- Right aligned frozen column results in clipping when scrollbar appears -->
<SelectiveScrollingGrid>
    <SelectiveScrollingGrid.ColumnDefinitions>
      <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </SelectiveScrollingGrid.ColumnDefinitions>

    <DataGridCellsPresenter Grid.Column="0" ItemsPanel="{TemplateBinding ItemsPanel}" />
    <DataGridRowHeader Grid.Column="1" 
         SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
</SelectiveScrollingGrid>

上記は機能しません (グリッドを含むウィンドウのサイズを変更すると、スクロールバーが表示されたときに DataGridRowHeader 領域がクリップされます)。

ただし、以下の XAML は問題なく動作します。

<!-- Left aligned frozen column works! -->
<SelectiveScrollingGrid>
    <SelectiveScrollingGrid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
      <ColumnDefinition Width="*"/>
    </SelectiveScrollingGrid.ColumnDefinitions>

    <DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" />
    <DataGridRowHeader Grid.Column="0" 
         SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
</SelectiveScrollingGrid>

SelectiveScrollingGrid を右側の固定列で使用できますか? そうでない場合、別の解決策はありますか?

4

1 に答える 1