Possible fix when inapp theme is changed

This commit is contained in:
Daniel Clark
2021-02-09 19:08:10 +00:00
parent 732a25d03a
commit cb837f034c
10 changed files with 64 additions and 49 deletions
@@ -0,0 +1,27 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
namespace NotificationFlyout.Uwp.UI.Controls
{
public class NotificationFlyoutPresenter : ContentControl
{
public NotificationFlyoutPresenter()
{
DefaultStyleKey = typeof(NotificationFlyoutPresenter);
}
protected override void OnApplyTemplate()
{
if (GetTemplateChild("ContentPresenter") is ContentControl contentPresenter)
{
BindingOperations.SetBinding(this, RequestedThemeProperty, new Binding
{
Source = contentPresenter.Content,
Path = new PropertyPath(nameof(RequestedTheme)),
Mode = BindingMode.TwoWay
});
}
}
}
}