Skip to content

Commit

Permalink
feat: select all
Browse files Browse the repository at this point in the history
  • Loading branch information
giard-alexandre committed Oct 4, 2024
1 parent b12b8fe commit dbc3f21
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
43 changes: 28 additions & 15 deletions src/DynamicTreeDataGrid/Controls/ColumnListView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,32 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="DynamicTreeDataGrid.Controls.ColumnListView"
x:DataType="columns:IDynamicColumns">
<ScrollViewer Name="MainContainer" HorizontalAlignment="Stretch">
<!-- Background="Transparent" is required here in order for the DragDrop stuff to work properly. -->
<ItemsRepeater ItemsSource="{Binding .}" DragDrop.AllowDrop="True"
Background="Transparent" Margin="10">
<ItemsRepeater.Layout>
<NonVirtualizingStackLayout />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="columns:IDynamicColumn">
<controls:ColumnItemView ToolTip.Tip="{Binding Name}" Padding="5"
PointerPressed="OnPointerPressed" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
<DockPanel>
<UniformGrid DockPanel.Dock="Top" Columns="2" Rows="1">
<UniformGrid.Styles>
<Style Selector="Button">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Margin" Value="10" />
</Style>
</UniformGrid.Styles>
<Button Click="ShowAllClicked">Show All</Button>
<Button Click="HideAllClicked">Hide All</Button>
</UniformGrid>
<ScrollViewer Name="MainContainer" HorizontalAlignment="Stretch">
<!-- Background="Transparent" is required here in order for the DragDrop stuff to work properly. -->
<ItemsRepeater ItemsSource="{Binding .}" DragDrop.AllowDrop="True"
Background="Transparent" Margin="10">
<ItemsRepeater.Layout>
<NonVirtualizingStackLayout />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="columns:IDynamicColumn">
<controls:ColumnItemView ToolTip.Tip="{Binding Name}" Padding="5"
PointerPressed="OnPointerPressed" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
</DockPanel>
</UserControl>
9 changes: 9 additions & 0 deletions src/DynamicTreeDataGrid/Controls/ColumnListView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Avalonia.Controls;
using Avalonia.Controls.Models.TreeDataGrid;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.VisualTree;

Expand Down Expand Up @@ -94,4 +95,12 @@ private static bool TryGetColumn(Control? control, [MaybeNullWhen(false)] out ID
}
}
}

private void ShowAllClicked(object? sender, RoutedEventArgs e) {
if(DataContext is not IDynamicColumns columns) return;
// for (int i = 0; i < columns.Count; i++) {
//
// }
}
private void HideAllClicked(object? sender, RoutedEventArgs e) { throw new NotImplementedException(); }
}

0 comments on commit dbc3f21

Please sign in to comment.