Reorg project folders

This commit is contained in:
Daniel Clark
2021-02-14 15:19:33 +00:00
parent 266f1938c3
commit cadf8f9ec0
61 changed files with 36 additions and 36 deletions
@@ -0,0 +1,51 @@
using Microsoft.Toolkit.Wpf.UI.XamlHost;
using System;
using System.Windows;
namespace NotificationFlyout.Wpf.UI.Controls
{
internal class XamlHost<TXamlContent> : Window where TXamlContent : Windows.UI.Xaml.UIElement
{
protected new bool IsLoaded;
private WindowsXamlHost _xamlHost;
public XamlHost()
{
PrepareWindowsXamlHost();
ContentRendered += OnContentRendered;
}
internal TXamlContent GetHostContent()
{
if (_xamlHost == null) return null;
return _xamlHost.GetUwpInternalObject() as TXamlContent;
}
protected virtual void OnContentLoaded()
{
}
protected virtual WindowsXamlHost OnPreparingXamlHost(WindowsXamlHost xamlHost)
{
xamlHost.InitialTypeName = typeof(TXamlContent).FullName;
xamlHost.HorizontalAlignment = HorizontalAlignment.Stretch;
xamlHost.VerticalAlignment = VerticalAlignment.Stretch;
return xamlHost;
}
private void OnContentRendered(object sender, EventArgs args)
{
IsLoaded = true;
OnContentLoaded();
}
private void PrepareWindowsXamlHost()
{
_xamlHost = new WindowsXamlHost();
OnPreparingXamlHost(_xamlHost);
Content = _xamlHost;
}
}
}