Add CanUserResizeColumns property
This commit is contained in:
Родитель
b53875cc82
Коммит
79ca0239c8
|
@ -85,8 +85,14 @@
|
|||
<Separator Grid.Row="0" Grid.RowSpan="3" Grid.Column="1" Background="Gray" Width="1"/>
|
||||
<Separator Grid.Row="0" Grid.RowSpan="3" Grid.Column="3" Background="Gray" Width="1"/>
|
||||
<!-- Splitters -->
|
||||
<GridSplitter Grid.Row="0" Grid.RowSpan="3" Grid.Column="1" Background="Transparent" ResizeDirection="Columns"/>
|
||||
<GridSplitter Grid.Row="0" Grid.RowSpan="3" Grid.Column="3" Background="Transparent" ResizeDirection="Columns"/>
|
||||
<GridSplitter Grid.Row="0" Grid.RowSpan="3" Grid.Column="1"
|
||||
Background="Transparent"
|
||||
ResizeDirection="Columns"
|
||||
IsEnabled="{TemplateBinding CanUserResizeColumns}"/>
|
||||
<GridSplitter Grid.Row="0" Grid.RowSpan="3" Grid.Column="3"
|
||||
Background="Transparent"
|
||||
ResizeDirection="Columns"
|
||||
IsEnabled="{TemplateBinding CanUserResizeColumns}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
|
|
@ -16,6 +16,9 @@ namespace ItemsRepeaterDataGrid
|
|||
public static readonly StyledProperty<object?> SelectedItemProperty =
|
||||
AvaloniaProperty.Register<DataGrid, object?>(nameof(SelectedItem));
|
||||
|
||||
public static readonly StyledProperty<bool> CanUserResizeColumnsProperty =
|
||||
AvaloniaProperty.Register<DataGrid, bool>(nameof(CanUserResizeColumns));
|
||||
|
||||
public AvaloniaList<DataGridColumn> Columns
|
||||
{
|
||||
get => GetValue(ColumnsProperty);
|
||||
|
@ -33,5 +36,11 @@ namespace ItemsRepeaterDataGrid
|
|||
get => GetValue(SelectedItemProperty);
|
||||
set => SetValue(SelectedItemProperty, value);
|
||||
}
|
||||
|
||||
public bool CanUserResizeColumns
|
||||
{
|
||||
get => GetValue(CanUserResizeColumnsProperty);
|
||||
set => SetValue(CanUserResizeColumnsProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<g:DataGrid Items="{Binding Items}">
|
||||
<g:DataGrid Items="{Binding Items}"
|
||||
CanUserResizeColumns="True">
|
||||
<g:DataGrid.Columns>
|
||||
<!-- Column1 -->
|
||||
<g:DataGridTemplateColumn Header="Column1" Width="150">
|
||||
|
|
Загрузка…
Ссылка в новой задаче