diff --git a/controls/dev/AnnotatedScrollBar/AnnotatedScrollBar.cpp b/controls/dev/AnnotatedScrollBar/AnnotatedScrollBar.cpp
index cd5c0e2d70..f6c14b2480 100644
--- a/controls/dev/AnnotatedScrollBar/AnnotatedScrollBar.cpp
+++ b/controls/dev/AnnotatedScrollBar/AnnotatedScrollBar.cpp
@@ -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);
diff --git a/controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml b/controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml
index 7117e4e27f..01c44209c1 100644
--- a/controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml
+++ b/controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml
@@ -310,7 +310,7 @@
-
\ No newline at end of file
+
diff --git a/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml b/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml
index 93c579a5c8..84ee172d61 100644
--- a/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml
+++ b/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml
@@ -293,6 +293,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml.cs b/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml.cs
index 9bd57e40e7..ae0710d662 100644
--- a/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml.cs
+++ b/controls/dev/CommonStyles/TestUI/CommonStylesPage.xaml.cs
@@ -47,6 +47,11 @@ public sealed partial class CommonStylesPage : TestPage
{
ObservableCollection fonts = new ObservableCollection();
+ private string[] miscellaneousGridViewSource =
+ {
+ "GridView Item #1",
+ };
+
public CommonStylesPage()
{
this.InitializeComponent();
@@ -54,6 +59,12 @@ public CommonStylesPage()
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";
diff --git a/controls/dev/CommonStyles/TestUI/ContentDialogPage.xaml.cs b/controls/dev/CommonStyles/TestUI/ContentDialogPage.xaml.cs
index d1b2e215b1..40cf59dde5 100644
--- a/controls/dev/CommonStyles/TestUI/ContentDialogPage.xaml.cs
+++ b/controls/dev/CommonStyles/TestUI/ContentDialogPage.xaml.cs
@@ -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();
}
diff --git a/controls/dev/Generated/InfoBar.properties.cpp b/controls/dev/Generated/InfoBar.properties.cpp
index 2ba3cbf7f5..08a1d291c1 100644
--- a/controls/dev/Generated/InfoBar.properties.cpp
+++ b/controls/dev/Generated/InfoBar.properties.cpp
@@ -47,7 +47,7 @@ void InfoBarProperties::EnsureProperties()
winrt::name_of(),
false /* isAttached */,
ValueHelper::BoxedDefaultValue(),
- nullptr);
+ winrt::PropertyChangedCallback(&OnActionButtonPropertyChanged));
}
if (!s_CloseButtonCommandProperty)
{
@@ -157,7 +157,7 @@ void InfoBarProperties::EnsureProperties()
winrt::name_of(),
false /* isAttached */,
ValueHelper::BoxedDefaultValue(),
- nullptr);
+ winrt::PropertyChangedCallback(&OnMessagePropertyChanged));
}
if (!s_SeverityProperty)
{
@@ -190,7 +190,7 @@ void InfoBarProperties::EnsureProperties()
winrt::name_of(),
false /* isAttached */,
ValueHelper::BoxedDefaultValue(),
- nullptr);
+ winrt::PropertyChangedCallback(&OnTitlePropertyChanged));
}
}
@@ -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::get_self(owner)->OnActionButtonPropertyChanged(args);
+}
+
void InfoBarProperties::OnIconSourcePropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
@@ -244,6 +252,14 @@ void InfoBarProperties::OnIsOpenPropertyChanged(
winrt::get_self(owner)->OnIsOpenPropertyChanged(args);
}
+void InfoBarProperties::OnMessagePropertyChanged(
+ winrt::DependencyObject const& sender,
+ winrt::DependencyPropertyChangedEventArgs const& args)
+{
+ auto owner = sender.as();
+ winrt::get_self(owner)->OnMessagePropertyChanged(args);
+}
+
void InfoBarProperties::OnSeverityPropertyChanged(
winrt::DependencyObject const& sender,
winrt::DependencyPropertyChangedEventArgs const& args)
@@ -252,6 +268,14 @@ void InfoBarProperties::OnSeverityPropertyChanged(
winrt::get_self(owner)->OnSeverityPropertyChanged(args);
}
+void InfoBarProperties::OnTitlePropertyChanged(
+ winrt::DependencyObject const& sender,
+ winrt::DependencyPropertyChangedEventArgs const& args)
+{
+ auto owner = sender.as();
+ winrt::get_self(owner)->OnTitlePropertyChanged(args);
+}
+
void InfoBarProperties::ActionButton(winrt::ButtonBase const& value)
{
[[gsl::suppress(con)]]
diff --git a/controls/dev/Generated/InfoBar.properties.h b/controls/dev/Generated/InfoBar.properties.h
index c0350ff35a..c07d4952cf 100644
--- a/controls/dev/Generated/InfoBar.properties.h
+++ b/controls/dev/Generated/InfoBar.properties.h
@@ -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);
@@ -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);
};
diff --git a/controls/dev/InfoBar/InfoBar.cpp b/controls/dev/InfoBar/InfoBar.cpp
index bd4802efa7..fbcf69c362 100644
--- a/controls/dev/InfoBar/InfoBar.cpp
+++ b/controls/dev/InfoBar/InfoBar.cpp
@@ -71,6 +71,7 @@ void InfoBar::OnApplyTemplate()
UpdateIconVisibility();
UpdateCloseButton();
UpdateForeground();
+ UpdateContentPosition();
}
void InfoBar::OnCloseButtonClick(winrt::IInspectable const& sender, winrt::RoutedEventArgs const& args)
@@ -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();
@@ -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)
diff --git a/controls/dev/InfoBar/InfoBar.h b/controls/dev/InfoBar/InfoBar.h
index 6f37491d21..75ca42e199 100644
--- a/controls/dev/InfoBar/InfoBar.h
+++ b/controls/dev/InfoBar/InfoBar.h
@@ -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);
@@ -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);
diff --git a/controls/dev/InfoBar/InfoBar.idl b/controls/dev/InfoBar/InfoBar.idl
index 40c79c4998..ff9104fc1f 100644
--- a/controls/dev/InfoBar/InfoBar.idl
+++ b/controls/dev/InfoBar/InfoBar.idl
@@ -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")]
@@ -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; };
diff --git a/controls/dev/InfoBar/InfoBar.xaml b/controls/dev/InfoBar/InfoBar.xaml
index d73ee43dc6..1f03688968 100644
--- a/controls/dev/InfoBar/InfoBar.xaml
+++ b/controls/dev/InfoBar/InfoBar.xaml
@@ -81,6 +81,14 @@
+
+
+
+
+
+
+
+
@@ -115,7 +123,7 @@
-
+