forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snappoints): Added support for Snap Points in ScrollViewer
- Loading branch information
1 parent
054a91c
commit a7158b4
Showing
17 changed files
with
809 additions
and
106 deletions.
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
58 changes: 58 additions & 0 deletions
58
...pp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_SnapPoints.xaml
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,58 @@ | ||
<Page | ||
x:Class="UITests.Windows_UI_Xaml_Controls.ScrollViewerTests.ScrollViewer_SnapPoints" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Windows_UI_Xaml_Controls.ScrollViewerTests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<StackPanel> | ||
<TextBlock>Snap Points</TextBlock> | ||
<ComboBox x:Name="snapPointsType" SelectedIndex="3"> | ||
<ComboBoxItem>None</ComboBoxItem> | ||
<ComboBoxItem>Optional</ComboBoxItem> | ||
<ComboBoxItem>OptionalSingle</ComboBoxItem> | ||
<ComboBoxItem>Mandatory</ComboBoxItem> | ||
<ComboBoxItem>MandatorySingle</ComboBoxItem> | ||
</ComboBox> | ||
<ComboBox x:Name="snapPointsAlignment" SelectedIndex="0"> | ||
<ComboBoxItem>Near</ComboBoxItem> | ||
<ComboBoxItem>Center</ComboBoxItem> | ||
<ComboBoxItem>Far</ComboBoxItem> | ||
</ComboBox> | ||
<Slider x:Name="spacing" Minimum="0" Maximum="30" Value="20" /> | ||
<Slider x:Name="height" Minimum="100" Maximum="400" Value="200" /> | ||
<Border BorderBrush="Black" BorderThickness="3" Width="200" Height="{Binding Value,ElementName=height}" HorizontalAlignment="Left"> | ||
<ScrollViewer | ||
VerticalSnapPointsType="{Binding SelectedItem.Content, ElementName=snapPointsType}" | ||
VerticalSnapPointsAlignment="{Binding SelectedItem.Content, ElementName=snapPointsAlignment}"> | ||
<StackPanel Spacing="{Binding Value, ElementName=spacing}" x:Name="panel"> | ||
<Rectangle Fill="#9400D3" Height="75" /> | ||
<Rectangle Fill="#4B0082" Height="75" /> | ||
<Rectangle Fill="#0000FF" Height="75" /> | ||
<Rectangle Fill="#00FF00" Height="75" /> | ||
<Rectangle Fill="#FFFF00" Height="75" /> | ||
<Rectangle Fill="#FF7F00" Height="75" /> | ||
<Rectangle Fill="#FF0000" Height="75" /> | ||
<Rectangle Fill="#9400D3" Height="75" /> | ||
<Rectangle Fill="#4B0082" Height="75" /> | ||
<Rectangle Fill="#0000FF" Height="75" /> | ||
<Rectangle Fill="#00FF00" Height="75" /> | ||
<Rectangle Fill="#FFFF00" Height="75" /> | ||
<Rectangle Fill="#FF7F00" Height="75" /> | ||
<Rectangle Fill="#FF0000" Height="75" /> | ||
<Rectangle Fill="#9400D3" Height="75" /> | ||
<Rectangle Fill="#4B0082" Height="75" /> | ||
<Rectangle Fill="#0000FF" Height="75" /> | ||
<Rectangle Fill="#00FF00" Height="75" /> | ||
<Rectangle Fill="#FFFF00" Height="75" /> | ||
<Rectangle Fill="#FF7F00" Height="75" /> | ||
<Rectangle Fill="#FF0000" Height="75" /> | ||
</StackPanel> | ||
</ScrollViewer> | ||
</Border> | ||
<TextBlock x:Name="points" /> | ||
</StackPanel> | ||
</Page> |
33 changes: 33 additions & 0 deletions
33
...UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_SnapPoints.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,33 @@ | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Uno.UI.Samples.Controls; | ||
|
||
namespace UITests.Windows_UI_Xaml_Controls.ScrollViewerTests | ||
{ | ||
[Sample("ScrollViewer")] | ||
public sealed partial class ScrollViewer_SnapPoints : Page | ||
{ | ||
public ScrollViewer_SnapPoints() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
panel.VerticalSnapPointsChanged += SnapPointsChanged; | ||
} | ||
|
||
private void SnapPointsChanged(object sender, object e) | ||
{ | ||
if (panel.AreVerticalSnapPointsRegular) | ||
{ | ||
points.Text = "Regular"; | ||
} | ||
else | ||
{ | ||
var near = string.Join(", ", panel.GetIrregularSnapPoints(Orientation.Vertical, SnapPointsAlignment.Near)); | ||
var center = string.Join(", ", panel.GetIrregularSnapPoints(Orientation.Vertical, SnapPointsAlignment.Center)); | ||
var far = string.Join(", ", panel.GetIrregularSnapPoints(Orientation.Vertical, SnapPointsAlignment.Far)); | ||
points.Text = $"near: {near}\ncenter: {center}\nfar: {far}"; | ||
} | ||
|
||
} | ||
} | ||
} |
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
Oops, something went wrong.