Skip to content

Commit a7cc340

Browse files
author
reunion-maestro-bot
committed
Syncing content from committish release/1.5-preview1
1 parent c4e32a2 commit a7cc340

File tree

69 files changed

+897
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+897
-486
lines changed

controls/dev/AnnotatedScrollBar/AnnotatedScrollBar.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,14 @@ void AnnotatedScrollBar::QueueLayoutLabels(unsigned int millisecondWait)
299299

300300
if (!m_labelsDebounce.test_and_set())
301301
{
302-
auto strongThis = get_strong(); // ensure object lifetime during coroutines
303-
auto runLayoutLabelsAction = [&, strongThis]()
302+
auto weakThis = get_weak();
303+
auto runLayoutLabelsAction = [weakThis]()
304304
{
305-
strongThis->m_labelsDebounce.clear();
306-
strongThis->LayoutLabels();
305+
if (auto strongThis = weakThis.get())
306+
{
307+
strongThis->m_labelsDebounce.clear();
308+
strongThis->LayoutLabels();
309+
}
307310
};
308311

309312
SharedHelpers::ScheduleActionAfterWait(runLayoutLabelsAction, millisecondWait);

controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
</Setter>
311311
</Style>
312312
<Style x:Key="CommandBarFlyoutAppBarButtonStyle" TargetType="AppBarButton" BasedOn="{StaticResource CommandBarFlyoutAppBarButtonStyleBase}">
313-
<Setter Property="KeyboardAcceleratorPlacementMode" Value="Hidden" />
313+
<Setter Property="KeyboardAcceleratorPlacementMode" Value="Hidden" />
314314
</Style>
315315
<Style x:Key="CommandBarFlyoutAppBarToggleButtonStyleBase" TargetType="AppBarToggleButton">
316316
<Setter Property="Background" Value="{ThemeResource CommandBarFlyoutAppBarButtonBackground}" />
@@ -1048,13 +1048,13 @@
10481048
</ItemsPanelTemplate>
10491049
</ItemsControl.ItemsPanel>
10501050
</ItemsControl>
1051-
<Button x:Name="MoreButton" Foreground="{TemplateBinding Foreground}" Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}" Grid.Column="1" Control.IsTemplateKeyTipTarget="True" IsAccessKeyScope="True" IsTabStop="False" CornerRadius="{TemplateBinding CornerRadius}" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CommandBarTemplateSettings.EffectiveOverflowButtonVisibility}">
1052-
<Button.RenderTransform>
1053-
<TranslateTransform x:Name="MoreButtonTransform" />
1054-
</Button.RenderTransform>
1051+
<Button x:Name="MoreButton" Foreground="{TemplateBinding Foreground}" Style="{StaticResource CommandBarFlyoutEllipsisButtonStyle}" Grid.Column="1" Control.IsTemplateKeyTipTarget="True" IsAccessKeyScope="True" IsTabStop="False" CornerRadius="{TemplateBinding CornerRadius}" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CommandBarTemplateSettings.EffectiveOverflowButtonVisibility}" AllowFocusOnInteraction="False">
1052+
<Button.RenderTransform>
1053+
<TranslateTransform x:Name="MoreButtonTransform" />
1054+
</Button.RenderTransform>
10551055
<FontIcon x:Name="EllipsisIcon" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE712;" />
1056-
</Button>
1057-
</Grid>
1056+
</Button>
1057+
</Grid>
10581058
<Popup x:Name="OverflowPopup" ShouldConstrainToRootBounds="False">
10591059
<!-- The name OuterOverflowContentRoot is treated specially by the system and causes a shadow placed on this
10601060
an element with this name to fade in. We don't want this for this style, so we need a different template part name -->

controls/dev/CommonStyles/InteractionTests/CommonStylesTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,28 @@ public void ScrollGroupedGridViewWithMandatorySnapPointsTest()
344344
}
345345
}
346346

347+
[TestMethod]
348+
public void ListViewBaseItemPageNavigationTest()
349+
{
350+
using (var setup = new TestSetupHelper("CommonStyles Tests"))
351+
{
352+
Log.Comment("Click on NavigateToNewPageButton");
353+
var button = new Button(FindElement.ByName("NavigateToNewPageButton"));
354+
355+
InputHelper.ScrollToElement(button);
356+
Wait.ForIdle();
357+
358+
// LeftClick is required in order for PointerCapture to happen
359+
InputHelper.LeftClick(button);
360+
Wait.ForIdle();
361+
362+
Log.Comment("Verify successful page navigation");
363+
var buttonNavigateToGridView = FindElement.ById("navigateToGridView");
364+
Verify.IsNotNull(buttonNavigateToGridView, "GridViewPage is expected to be loaded.");
365+
}
366+
}
367+
368+
347369
private bool TryWaitForEditValues(string editName, string editValue)
348370
{
349371
UIObject editUIObject = FindElement.ById(editName);

controls/dev/CommonStyles/MenuFlyout_themeresources.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@
383383
<ContentPresenter x:Name="IconContent" Content="{TemplateBinding Icon}" />
384384
</Viewbox>
385385
<TextBlock x:Name="TextBlock" Text="{TemplateBinding Text}" TextTrimming="{ThemeResource MenuFlyoutItemTextTrimming}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
386-
<TextBlock x:Name="KeyboardAcceleratorTextBlock" Grid.Column="1" Style="{ThemeResource CaptionTextBlockStyle}" Text="{TemplateBinding KeyboardAcceleratorTextOverride}" MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KeyboardAcceleratorTextMinWidth}" Margin="24,4,0,0" Foreground="{ThemeResource MenuFlyoutItemKeyboardAcceleratorTextForeground}" HorizontalAlignment="Right" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed" AutomationProperties.AccessibilityView="Raw" />
386+
<TextBlock x:Name="KeyboardAcceleratorTextBlock" Grid.Column="1" Style="{ThemeResource CaptionTextBlockStyle}" Text="{TemplateBinding KeyboardAcceleratorTextOverride}" MinWidth="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KeyboardAcceleratorTextMinWidth}" Margin="24,4,0,0" Foreground="{ThemeResource MenuFlyoutItemKeyboardAcceleratorTextForeground}" TextAlignment="Right" HorizontalAlignment="Right" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed" AutomationProperties.AccessibilityView="Raw" />
387387
</Grid>
388388
</ControlTemplate>
389389
</Setter.Value>
@@ -912,4 +912,4 @@
912912
</Setter.Value>
913913
</Setter>
914914
</Style>
915-
</ResourceDictionary>
915+
</ResourceDictionary>

controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,20 @@
293293
</Button.Resources>
294294
<FontIcon Glyph="&#xE781;" />
295295
</Button>
296+
<GridView x:Name="MiscellaneousGridView" ItemsSource="{x:Bind miscellaneousGridViewSource}" Margin="10">
297+
<GridView.ItemTemplate>
298+
<DataTemplate>
299+
<Grid>
300+
<Grid.RowDefinitions>
301+
<RowDefinition Height="30" />
302+
<RowDefinition Height="Auto" />
303+
</Grid.RowDefinitions>
304+
<TextBlock Text="{Binding}" VerticalAlignment="Center"/>
305+
<Button Grid.Row="1" x:Name="NavigateToNewPageButton" AutomationProperties.Name="NavigateToNewPageButton" Content="Navigate To New Page" Click="NavigateToNewPageButton_Click"/>
306+
</Grid>
307+
</DataTemplate>
308+
</GridView.ItemTemplate>
309+
</GridView>
296310
</StackPanel>
297311
<StackPanel Style="{ThemeResource CompactPanelStyle}">
298312
<TextBlock Text="ListViewItem/GridViewItem testing area" Style="{ThemeResource StandardGroupHeader}"/>

controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,24 @@ public sealed partial class CommonStylesPage : TestPage
4747
{
4848
ObservableCollection<FontFamily> fonts = new ObservableCollection<FontFamily>();
4949

50+
private string[] miscellaneousGridViewSource =
51+
{
52+
"GridView Item #1",
53+
};
54+
5055
public CommonStylesPage()
5156
{
5257
this.InitializeComponent();
5358
fonts.Add(new FontFamily("Arial"));
5459
fonts.Add(new FontFamily("Courier New"));
5560
fonts.Add(new FontFamily("Times New Roman"));
5661
}
62+
63+
private void NavigateToNewPageButton_Click(object sender, RoutedEventArgs e)
64+
{
65+
Frame.NavigateWithoutAnimation(typeof(GridViewPage), 0);
66+
}
67+
5768
private void SliderDensityTest_Click(object sender, RoutedEventArgs e)
5869
{
5970
string expectSliderPreContentMargin = "14";

controls/dev/CommonStyles/TestUI/ContentDialogPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ private void ShowBorderThickness_Click(object sender, RoutedEventArgs e)
3232
BorderThickness = new Thickness(10, 20, 10, 20),
3333
CloseButtonText = "CloseButton",
3434
BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)),
35-
XamlRoot = this.XamlRoot
3635
};
36+
dialog.XamlRoot = this.XamlRoot;
3737
_ = CreateContentDialog().ShowAsync();
3838
}
3939

controls/dev/Generated/InfoBar.properties.cpp

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void InfoBarProperties::EnsureProperties()
4747
winrt::name_of<winrt::InfoBar>(),
4848
false /* isAttached */,
4949
ValueHelper<winrt::ButtonBase>::BoxedDefaultValue(),
50-
nullptr);
50+
winrt::PropertyChangedCallback(&OnActionButtonPropertyChanged));
5151
}
5252
if (!s_CloseButtonCommandProperty)
5353
{
@@ -157,7 +157,7 @@ void InfoBarProperties::EnsureProperties()
157157
winrt::name_of<winrt::InfoBar>(),
158158
false /* isAttached */,
159159
ValueHelper<winrt::hstring>::BoxedDefaultValue(),
160-
nullptr);
160+
winrt::PropertyChangedCallback(&OnMessagePropertyChanged));
161161
}
162162
if (!s_SeverityProperty)
163163
{
@@ -190,7 +190,7 @@ void InfoBarProperties::EnsureProperties()
190190
winrt::name_of<winrt::InfoBar>(),
191191
false /* isAttached */,
192192
ValueHelper<winrt::hstring>::BoxedDefaultValue(),
193-
nullptr);
193+
winrt::PropertyChangedCallback(&OnTitlePropertyChanged));
194194
}
195195
}
196196

@@ -212,6 +212,14 @@ void InfoBarProperties::ClearProperties()
212212
s_TitleProperty = nullptr;
213213
}
214214

215+
void InfoBarProperties::OnActionButtonPropertyChanged(
216+
winrt::DependencyObject const& sender,
217+
winrt::DependencyPropertyChangedEventArgs const& args)
218+
{
219+
auto owner = sender.as<winrt::InfoBar>();
220+
winrt::get_self<InfoBar>(owner)->OnActionButtonPropertyChanged(args);
221+
}
222+
215223
void InfoBarProperties::OnIconSourcePropertyChanged(
216224
winrt::DependencyObject const& sender,
217225
winrt::DependencyPropertyChangedEventArgs const& args)
@@ -244,6 +252,14 @@ void InfoBarProperties::OnIsOpenPropertyChanged(
244252
winrt::get_self<InfoBar>(owner)->OnIsOpenPropertyChanged(args);
245253
}
246254

255+
void InfoBarProperties::OnMessagePropertyChanged(
256+
winrt::DependencyObject const& sender,
257+
winrt::DependencyPropertyChangedEventArgs const& args)
258+
{
259+
auto owner = sender.as<winrt::InfoBar>();
260+
winrt::get_self<InfoBar>(owner)->OnMessagePropertyChanged(args);
261+
}
262+
247263
void InfoBarProperties::OnSeverityPropertyChanged(
248264
winrt::DependencyObject const& sender,
249265
winrt::DependencyPropertyChangedEventArgs const& args)
@@ -252,6 +268,14 @@ void InfoBarProperties::OnSeverityPropertyChanged(
252268
winrt::get_self<InfoBar>(owner)->OnSeverityPropertyChanged(args);
253269
}
254270

271+
void InfoBarProperties::OnTitlePropertyChanged(
272+
winrt::DependencyObject const& sender,
273+
winrt::DependencyPropertyChangedEventArgs const& args)
274+
{
275+
auto owner = sender.as<winrt::InfoBar>();
276+
winrt::get_self<InfoBar>(owner)->OnTitlePropertyChanged(args);
277+
}
278+
255279
void InfoBarProperties::ActionButton(winrt::ButtonBase const& value)
256280
{
257281
[[gsl::suppress(con)]]

controls/dev/Generated/InfoBar.properties.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ class InfoBarProperties
9595
static void EnsureProperties();
9696
static void ClearProperties();
9797

98+
static void OnActionButtonPropertyChanged(
99+
winrt::DependencyObject const& sender,
100+
winrt::DependencyPropertyChangedEventArgs const& args);
101+
98102
static void OnIconSourcePropertyChanged(
99103
winrt::DependencyObject const& sender,
100104
winrt::DependencyPropertyChangedEventArgs const& args);
@@ -111,7 +115,15 @@ class InfoBarProperties
111115
winrt::DependencyObject const& sender,
112116
winrt::DependencyPropertyChangedEventArgs const& args);
113117

118+
static void OnMessagePropertyChanged(
119+
winrt::DependencyObject const& sender,
120+
winrt::DependencyPropertyChangedEventArgs const& args);
121+
114122
static void OnSeverityPropertyChanged(
115123
winrt::DependencyObject const& sender,
116124
winrt::DependencyPropertyChangedEventArgs const& args);
125+
126+
static void OnTitlePropertyChanged(
127+
winrt::DependencyObject const& sender,
128+
winrt::DependencyPropertyChangedEventArgs const& args);
117129
};

controls/dev/InfoBar/InfoBar.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void InfoBar::OnApplyTemplate()
7171
UpdateIconVisibility();
7272
UpdateCloseButton();
7373
UpdateForeground();
74+
UpdateContentPosition();
7475
}
7576

7677
void InfoBar::OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
@@ -122,6 +123,21 @@ void InfoBar::OnIsOpenPropertyChanged(const winrt::DependencyPropertyChangedEven
122123
}
123124
}
124125

126+
void InfoBar::OnTitlePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
127+
{
128+
UpdateContentPosition();
129+
}
130+
131+
void InfoBar::OnMessagePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
132+
{
133+
UpdateContentPosition();
134+
}
135+
136+
void InfoBar::OnActionButtonPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
137+
{
138+
UpdateContentPosition();
139+
}
140+
125141
void InfoBar::OnSeverityPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
126142
{
127143
UpdateSeverity();
@@ -250,6 +266,11 @@ void InfoBar::UpdateForeground()
250266
winrt::VisualStateManager::GoToState(*this, ReadLocalValue(winrt::Control::ForegroundProperty()) == winrt::DependencyProperty::UnsetValue() ? L"ForegroundNotSet" : L"ForegroundSet", false);
251267
}
252268

269+
void InfoBar::UpdateContentPosition()
270+
{
271+
// If we don't have either a title or a message, then the content should move up
272+
winrt::VisualStateManager::GoToState(*this, Title().empty() && Message().empty() && !ActionButton() ? L"NoBannerContent" : L"BannerContent", false);
273+
}
253274
const winrt::hstring InfoBar::GetSeverityLevelResourceName(winrt::InfoBarSeverity severity)
254275
{
255276
switch (severity)

0 commit comments

Comments
 (0)