Skip to content

Commit

Permalink
Add StickyHeaderBehavior to DataTable Virtualization sample
Browse files Browse the repository at this point in the history
For now add a solid background, would be nice to have a fadebehavior on the items panel to fade behind the sticky header that's transparent still...
  • Loading branch information
michael-hawker committed Jul 17, 2023
1 parent 5a2545d commit 53c8743
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
31 changes: 20 additions & 11 deletions components/DataTable/samples/DataTableVirtualizationSample.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Page x:Class="DataTableExperiment.Samples.DataTableVirtualizationSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:DataTableExperiment.Samples"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
Expand All @@ -13,16 +15,23 @@
VerticalAlignment="Top"
ItemsSource="{x:Bind InventoryItems}">
<ListView.Header>
<controls:DataTable ColumnSpacing="16">
<controls:DataColumn Content="Id" />
<controls:DataColumn CanResize="True"
Content="Name" />
<controls:DataColumn CanResize="True">
<TextBlock FontWeight="SemiBold"
Text="Description" />
</controls:DataColumn>
<controls:DataColumn Content="Quantity" />
</controls:DataTable>
<Border Padding="8,4,0,4"
Background="{ThemeResource SolidBackgroundFillColorTertiaryBrush}"
CornerRadius="4">
<interactivity:Interaction.Behaviors>
<behaviors:StickyHeaderBehavior />
</interactivity:Interaction.Behaviors>
<controls:DataTable ColumnSpacing="16">
<controls:DataColumn Content="Id" />
<controls:DataColumn CanResize="True"
Content="Name" />
<controls:DataColumn CanResize="True">
<TextBlock FontWeight="SemiBold"
Text="Description" />
</controls:DataColumn>
<controls:DataColumn Content="Quantity" />
</controls:DataTable>
</Border>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:InventoryItem">
Expand Down
2 changes: 2 additions & 0 deletions components/DataTable/samples/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
<Project>
<!-- WinUI 2 / UWP / Uno -->
<ItemGroup Condition="'$(IsUwp)' == 'true' OR ('$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '2')">
<PackageReference Include="CommunityToolkit.Uwp.Behaviors" Version="8.0.0-beta.3"/>
<PackageReference Include="CommunityToolkit.Uwp.Controls.HeaderedControls" Version="8.0.0-beta.1"/>
</ItemGroup>

<!-- WinUI 3 / WinAppSdk / Uno -->
<ItemGroup Condition="'$(IsWinAppSdk)' == 'true' OR ('$(IsUno)' == 'true' AND '$(WinUIMajorVersion)' == '3')">
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.0.0-beta.3"/>
<PackageReference Include="CommunityToolkit.WinUI.Controls.HeaderedControls" Version="8.0.0-beta.1"/>
</ItemGroup>

Expand Down

0 comments on commit 53c8743

Please sign in to comment.