-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<ui:Page | ||
x:Class="MUXControlsTestApp.Samples.UniformGridLayoutDemo" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:ui="http://schemas.modernwpf.com/2019" | ||
xmlns:controls="clr-namespace:ModernWpf.Controls;assembly=ModernWpf.Controls" | ||
xmlns:sys="clr-namespace:System;assembly=mscorlib"> | ||
|
||
<Page.Resources> | ||
<!-- The Layout specifications used: --> | ||
<controls:UniformGridLayout x:Key="UniformGridLayout" | ||
MinRowSpacing="8" MinColumnSpacing="8" | ||
MaximumRowsOrColumns="4"/> | ||
|
||
<DataTemplate x:Key="SimpleElementTemplate" DataType="sys:String"> | ||
<Grid Background="{ThemeResource SystemControlForegroundBaseMediumLowBrush}" | ||
Width="100" | ||
Height="100"> | ||
<TextBlock Text="{Binding}" | ||
FontSize="20"/> | ||
</Grid> | ||
</DataTemplate> | ||
</Page.Resources> | ||
<StackPanel Orientation="Horizontal"> | ||
<ScrollViewer HorizontalScrollBarVisibility="Auto" | ||
AutomationProperties.Name="RepeaterScrollViewer" | ||
MaxHeight="500"> | ||
<controls:ItemsRepeater x:Name="UniformGridRepeater" | ||
Layout="{StaticResource UniformGridLayout}" | ||
ItemTemplate="{StaticResource SimpleElementTemplate}"/> | ||
</ScrollViewer> | ||
<StackPanel> | ||
<Button AutomationProperties.Name="GetRepeaterActualHeightButton" | ||
Click="GetRepeaterActualHeightButtonClick">Get actual Repeater height</Button> | ||
<TextBlock x:Name="RepeaterActualHeightLabel" AutomationProperties.Name="RepeaterActualHeightLabel"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</ui:Page> |
26 changes: 26 additions & 0 deletions
26
test/ModernWpfTestApp/Samples/UniformGridLayoutDemo.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Windows; | ||
|
||
namespace MUXControlsTestApp.Samples | ||
{ | ||
public sealed partial class UniformGridLayoutDemo | ||
{ | ||
public IEnumerable<int> collection; | ||
|
||
public UniformGridLayoutDemo() | ||
{ | ||
collection = Enumerable.Range(0, 40); | ||
this.InitializeComponent(); | ||
UniformGridRepeater.ItemsSource = collection; | ||
} | ||
|
||
public void GetRepeaterActualHeightButtonClick(object sender, RoutedEventArgs e) | ||
{ | ||
RepeaterActualHeightLabel.Text = UniformGridRepeater.ActualHeight.ToString(); | ||
} | ||
} | ||
} |