-
Notifications
You must be signed in to change notification settings - Fork 702
Add RepositionThemeTransition to sample pages for smoother layout updates
#2047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0258b14
66bed43
8e6c350
8adcbc2
5b5f8c9
acc0da6
e4b8152
e245bf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Page | ||
| x:Class="WinUIGallery.Controls.SamplePage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d"/> | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.UI.Xaml; | ||
| using Microsoft.UI.Xaml.Controls; | ||
| using Microsoft.UI.Xaml.Media.Animation; | ||
|
|
||
|
|
||
| namespace WinUIGallery.Controls; | ||
|
|
||
| public partial class SamplePage : Page | ||
| { | ||
| public SamplePage() | ||
| { | ||
| InitializeComponent(); | ||
| Loaded += SamplePage_Loaded; | ||
| } | ||
|
|
||
| private void SamplePage_Loaded(object sender, RoutedEventArgs e) | ||
| { | ||
| if (Content is Panel panel) | ||
| { | ||
| if (panel.ChildrenTransitions == null) | ||
| { | ||
| panel.ChildrenTransitions = new TransitionCollection(); | ||
| } | ||
|
|
||
| // Add RepositionThemeTransition only once | ||
| bool hasReposition = false; | ||
| foreach (var t in panel.ChildrenTransitions) | ||
| { | ||
| if (t is RepositionThemeTransition) | ||
| { | ||
| hasReposition = true; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (!hasReposition) | ||
| { | ||
| panel.ChildrenTransitions.Add(new RepositionThemeTransition()); | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,10 @@ | |
| </ResourceDictionary> | ||
| </Page.Resources> | ||
| <StackPanel> | ||
| <StackPanel.ChildrenTransitions> | ||
| <RepositionThemeTransition /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifying 74 files manually is an anti-pattern for maintainability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Saharsh979 @niels9001 I have another idea I introduced a new Should we extend this behaviour to all sample pages? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would love to get @marcelwgn's opinion here |
||
| </StackPanel.ChildrenTransitions> | ||
|
|
||
| <RichTextBlock> | ||
| <Paragraph> | ||
| Acrylic Brush might fall back to SolidColorbrush in certain scenarios. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.