Skip to content

Commit

Permalink
Syncing content from committish release/1.5-preview1
Browse files Browse the repository at this point in the history
  • Loading branch information
reunion-maestro-bot committed Feb 13, 2024
1 parent c4e32a2 commit a7cc340
Show file tree
Hide file tree
Showing 69 changed files with 897 additions and 486 deletions.
11 changes: 7 additions & 4 deletions controls/dev/AnnotatedScrollBar/AnnotatedScrollBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,14 @@ void AnnotatedScrollBar::QueueLayoutLabels(unsigned int millisecondWait)

if (!m_labelsDebounce.test_and_set())
{
auto strongThis = get_strong(); // ensure object lifetime during coroutines
auto runLayoutLabelsAction = [&, strongThis]()
auto weakThis = get_weak();
auto runLayoutLabelsAction = [weakThis]()
{
strongThis->m_labelsDebounce.clear();
strongThis->LayoutLabels();
if (auto strongThis = weakThis.get())
{
strongThis->m_labelsDebounce.clear();
strongThis->LayoutLabels();
}
};

SharedHelpers::ScheduleActionAfterWait(runLayoutLabelsAction, millisecondWait);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
</Setter>
</Style>
<Style x:Key="CommandBarFlyoutAppBarButtonStyle" TargetType="AppBarButton" BasedOn="{StaticResource CommandBarFlyoutAppBarButtonStyleBase}">
<Setter Property="KeyboardAcceleratorPlacementMode" Value="Hidden" />
<Setter Property="KeyboardAcceleratorPlacementMode" Value="Hidden" />
</Style>
<Style x:Key="CommandBarFlyoutAppBarToggleButtonStyleBase" TargetType="AppBarToggleButton">
<Setter Property="Background" Value="{ThemeResource CommandBarFlyoutAppBarButtonBackground}" />
Expand Down Expand Up @@ -1048,13 +1048,13 @@
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<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}">
<Button.RenderTransform>
<TranslateTransform x:Name="MoreButtonTransform" />
</Button.RenderTransform>
<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">
<Button.RenderTransform>
<TranslateTransform x:Name="MoreButtonTransform" />
</Button.RenderTransform>
<FontIcon x:Name="EllipsisIcon" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE712;" />
</Button>
</Grid>
</Button>
</Grid>
<Popup x:Name="OverflowPopup" ShouldConstrainToRootBounds="False">
<!-- The name OuterOverflowContentRoot is treated specially by the system and causes a shadow placed on this
an element with this name to fade in. We don't want this for this style, so we need a different template part name -->
Expand Down
22 changes: 22 additions & 0 deletions controls/dev/CommonStyles/InteractionTests/CommonStylesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,28 @@ public void ScrollGroupedGridViewWithMandatorySnapPointsTest()
}
}

[TestMethod]
public void ListViewBaseItemPageNavigationTest()
{
using (var setup = new TestSetupHelper("CommonStyles Tests"))
{
Log.Comment("Click on NavigateToNewPageButton");
var button = new Button(FindElement.ByName("NavigateToNewPageButton"));

InputHelper.ScrollToElement(button);
Wait.ForIdle();

// LeftClick is required in order for PointerCapture to happen
InputHelper.LeftClick(button);
Wait.ForIdle();

Log.Comment("Verify successful page navigation");
var buttonNavigateToGridView = FindElement.ById("navigateToGridView");
Verify.IsNotNull(buttonNavigateToGridView, "GridViewPage is expected to be loaded.");
}
}


private bool TryWaitForEditValues(string editName, string editValue)
{
UIObject editUIObject = FindElement.ById(editName);
Expand Down
4 changes: 2 additions & 2 deletions controls/dev/CommonStyles/MenuFlyout_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
<ContentPresenter x:Name="IconContent" Content="{TemplateBinding Icon}" />
</Viewbox>
<TextBlock x:Name="TextBlock" Text="{TemplateBinding Text}" TextTrimming="{ThemeResource MenuFlyoutItemTextTrimming}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<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" />
<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" />
</Grid>
</ControlTemplate>
</Setter.Value>
Expand Down Expand Up @@ -912,4 +912,4 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary>
14 changes: 14 additions & 0 deletions controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,20 @@
</Button.Resources>
<FontIcon Glyph="&#xE781;" />
</Button>
<GridView x:Name="MiscellaneousGridView" ItemsSource="{x:Bind miscellaneousGridViewSource}" Margin="10">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="{Binding}" VerticalAlignment="Center"/>
<Button Grid.Row="1" x:Name="NavigateToNewPageButton" AutomationProperties.Name="NavigateToNewPageButton" Content="Navigate To New Page" Click="NavigateToNewPageButton_Click"/>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</StackPanel>
<StackPanel Style="{ThemeResource CompactPanelStyle}">
<TextBlock Text="ListViewItem/GridViewItem testing area" Style="{ThemeResource StandardGroupHeader}"/>
Expand Down
11 changes: 11 additions & 0 deletions controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,24 @@ public sealed partial class CommonStylesPage : TestPage
{
ObservableCollection<FontFamily> fonts = new ObservableCollection<FontFamily>();

private string[] miscellaneousGridViewSource =
{
"GridView Item #1",
};

public CommonStylesPage()
{
this.InitializeComponent();
fonts.Add(new FontFamily("Arial"));
fonts.Add(new FontFamily("Courier New"));
fonts.Add(new FontFamily("Times New Roman"));
}

private void NavigateToNewPageButton_Click(object sender, RoutedEventArgs e)
{
Frame.NavigateWithoutAnimation(typeof(GridViewPage), 0);
}

private void SliderDensityTest_Click(object sender, RoutedEventArgs e)
{
string expectSliderPreContentMargin = "14";
Expand Down
2 changes: 1 addition & 1 deletion controls/dev/CommonStyles/TestUI/ContentDialogPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ private void ShowBorderThickness_Click(object sender, RoutedEventArgs e)
BorderThickness = new Thickness(10, 20, 10, 20),
CloseButtonText = "CloseButton",
BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)),
XamlRoot = this.XamlRoot
};
dialog.XamlRoot = this.XamlRoot;
_ = CreateContentDialog().ShowAsync();
}

Expand Down
30 changes: 27 additions & 3 deletions controls/dev/Generated/InfoBar.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void InfoBarProperties::EnsureProperties()
winrt::name_of<winrt::InfoBar>(),
false /* isAttached */,
ValueHelper<winrt::ButtonBase>::BoxedDefaultValue(),
nullptr);
winrt::PropertyChangedCallback(&OnActionButtonPropertyChanged));
}
if (!s_CloseButtonCommandProperty)
{
Expand Down Expand Up @@ -157,7 +157,7 @@ void InfoBarProperties::EnsureProperties()
winrt::name_of<winrt::InfoBar>(),
false /* isAttached */,
ValueHelper<winrt::hstring>::BoxedDefaultValue(),
nullptr);
winrt::PropertyChangedCallback(&OnMessagePropertyChanged));
}
if (!s_SeverityProperty)
{
Expand Down Expand Up @@ -190,7 +190,7 @@ void InfoBarProperties::EnsureProperties()
winrt::name_of<winrt::InfoBar>(),
false /* isAttached */,
ValueHelper<winrt::hstring>::BoxedDefaultValue(),
nullptr);
winrt::PropertyChangedCallback(&OnTitlePropertyChanged));
}
}

Expand All @@ -212,6 +212,14 @@ void InfoBarProperties::ClearProperties()
s_TitleProperty = nullptr;
}

void InfoBarProperties::OnActionButtonPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::InfoBar>();
winrt::get_self<InfoBar>(owner)->OnActionButtonPropertyChanged(args);
}

void InfoBarProperties::OnIconSourcePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
Expand Down Expand Up @@ -244,6 +252,14 @@ void InfoBarProperties::OnIsOpenPropertyChanged(
winrt::get_self<InfoBar>(owner)->OnIsOpenPropertyChanged(args);
}

void InfoBarProperties::OnMessagePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::InfoBar>();
winrt::get_self<InfoBar>(owner)->OnMessagePropertyChanged(args);
}

void InfoBarProperties::OnSeverityPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
Expand All @@ -252,6 +268,14 @@ void InfoBarProperties::OnSeverityPropertyChanged(
winrt::get_self<InfoBar>(owner)->OnSeverityPropertyChanged(args);
}

void InfoBarProperties::OnTitlePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
{
auto owner = sender.as<winrt::InfoBar>();
winrt::get_self<InfoBar>(owner)->OnTitlePropertyChanged(args);
}

void InfoBarProperties::ActionButton(winrt::ButtonBase const& value)
{
[[gsl::suppress(con)]]
Expand Down
12 changes: 12 additions & 0 deletions controls/dev/Generated/InfoBar.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class InfoBarProperties
static void EnsureProperties();
static void ClearProperties();

static void OnActionButtonPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnIconSourcePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);
Expand All @@ -111,7 +115,15 @@ class InfoBarProperties
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnMessagePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnSeverityPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);

static void OnTitlePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args);
};
21 changes: 21 additions & 0 deletions controls/dev/InfoBar/InfoBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void InfoBar::OnApplyTemplate()
UpdateIconVisibility();
UpdateCloseButton();
UpdateForeground();
UpdateContentPosition();
}

void InfoBar::OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
Expand Down Expand Up @@ -122,6 +123,21 @@ void InfoBar::OnIsOpenPropertyChanged(const winrt::DependencyPropertyChangedEven
}
}

void InfoBar::OnTitlePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
{
UpdateContentPosition();
}

void InfoBar::OnMessagePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
{
UpdateContentPosition();
}

void InfoBar::OnActionButtonPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
{
UpdateContentPosition();
}

void InfoBar::OnSeverityPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args)
{
UpdateSeverity();
Expand Down Expand Up @@ -250,6 +266,11 @@ void InfoBar::UpdateForeground()
winrt::VisualStateManager::GoToState(*this, ReadLocalValue(winrt::Control::ForegroundProperty()) == winrt::DependencyProperty::UnsetValue() ? L"ForegroundNotSet" : L"ForegroundSet", false);
}

void InfoBar::UpdateContentPosition()
{
// If we don't have either a title or a message, then the content should move up
winrt::VisualStateManager::GoToState(*this, Title().empty() && Message().empty() && !ActionButton() ? L"NoBannerContent" : L"BannerContent", false);
}
const winrt::hstring InfoBar::GetSeverityLevelResourceName(winrt::InfoBarSeverity severity)
{
switch (severity)
Expand Down
4 changes: 4 additions & 0 deletions controls/dev/InfoBar/InfoBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class InfoBar :
void OnIconSourcePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnIsIconVisiblePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnIsClosablePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnTitlePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnActionButtonPropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);
void OnMessagePropertyChanged(const winrt::DependencyPropertyChangedEventArgs& args);

private:
void OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args);
Expand All @@ -43,6 +46,7 @@ class InfoBar :
void UpdateIconVisibility();
void UpdateCloseButton();
void UpdateForeground();
void UpdateContentPosition();

const winrt::hstring GetCloseButtonResourceName(winrt::InfoBarSeverity severity);
const winrt::hstring GetSeverityLevelResourceName(winrt::InfoBarSeverity severity);
Expand Down
4 changes: 4 additions & 0 deletions controls/dev/InfoBar/InfoBar.idl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ unsealed runtimeclass InfoBar : Microsoft.UI.Xaml.Controls.Control
[MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
Boolean IsOpen{ get; set; };

[MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
String Title{ get; set; };

[MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
String Message{ get; set; };

[MUX_DEFAULT_VALUE("winrt::InfoBarSeverity::Informational")]
Expand All @@ -78,6 +81,7 @@ unsealed runtimeclass InfoBar : Microsoft.UI.Xaml.Controls.Control
Microsoft.UI.Xaml.Input.ICommand CloseButtonCommand{ get; set; };
Object CloseButtonCommandParameter{ get; set; };

[MUX_PROPERTY_CHANGED_CALLBACK(TRUE)]
Microsoft.UI.Xaml.Controls.Primitives.ButtonBase ActionButton{ get; set; };

Object Content{ get; set; };
Expand Down
12 changes: 10 additions & 2 deletions controls/dev/InfoBar/InfoBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup>
<VisualState x:Name="BannerContent"/>
<VisualState x:Name="NoBannerContent">
<VisualState.Setters>
<Setter Target="ContentArea.(Grid.Row)" Value="0"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- Background is used here so that it overrides the severity status color if set. -->
<Grid HorizontalAlignment="Stretch" MinHeight="{ThemeResource InfoBarMinHeight}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}" Padding="{StaticResource InfoBarContentRootPadding}">
Expand Down Expand Up @@ -115,7 +123,7 @@
</ContentPresenter.Resources>
</ContentPresenter>
</primitives:InfoBarPanel>
<ContentPresenter Grid.Column="1" Grid.Row="1" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
<ContentPresenter x:Name="ContentArea" Grid.Column="1" Grid.Row="1" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="Center"/>
<Button Name="CloseButton" Grid.Column="2" Command="{TemplateBinding CloseButtonCommand}" CommandParameter="{TemplateBinding CloseButtonCommandParameter}" Style="{TemplateBinding CloseButtonStyle}">
<Button.Resources>
<ResourceDictionary>
Expand Down Expand Up @@ -175,4 +183,4 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary>
1 change: 0 additions & 1 deletion controls/dev/ItemContainer/ItemContainer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
Opacity="0" />
<Rectangle
x:Name="PART_CommonVisual"
Fill="{ThemeResource ItemContainerBackground}"
Stroke="{ThemeResource ItemContainerBorderBrush}"
StrokeThickness="{ThemeResource ItemContainerSelectedInnerThickness}"
HorizontalAlignment="Stretch"
Expand Down
Loading

0 comments on commit a7cc340

Please sign in to comment.