No FrameHandler in WinUI for now... its too complex and broken
This commit is contained in:
@@ -181,6 +181,8 @@ public partial class ObservableCollection<TViewModel> :
|
||||
|
||||
Add(item);
|
||||
}
|
||||
|
||||
SelectedItem = this.FirstOrDefault();
|
||||
}
|
||||
|
||||
public void Clear(bool disposeItems = false)
|
||||
|
||||
@@ -10,6 +10,7 @@ using Windows.Win32.UI.WindowsAndMessaging;
|
||||
using Toolkit.Windows;
|
||||
using Rect = Windows.Foundation.Rect;
|
||||
using WinUIEx;
|
||||
using Windows.Graphics;
|
||||
|
||||
namespace Toolkit.UI.WinUI;
|
||||
|
||||
@@ -34,6 +35,17 @@ public static partial class WindowExtensions
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetSize(this Window window,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
nint handle = WindowNative.GetWindowHandle(window);
|
||||
if (handle == 0) return;
|
||||
|
||||
float value = PInvoke.GetDpiForWindow(new HWND(handle)) / 96f;
|
||||
window.AppWindow.Resize(new SizeInt32((int)(width * (double)value), (int)(height * (double)value)));
|
||||
}
|
||||
|
||||
public static void MoveAndResize(this Window window,
|
||||
Rect rect)
|
||||
{
|
||||
@@ -48,7 +60,7 @@ public static partial class WindowExtensions
|
||||
}
|
||||
|
||||
public static void SetBorderless(this Window window,
|
||||
bool value)
|
||||
bool value)
|
||||
{
|
||||
WindowStyle windowStyle = window.GetWindowStyle();
|
||||
|
||||
|
||||
@@ -29,15 +29,17 @@ public class ContentTemplate :
|
||||
}
|
||||
|
||||
protected override DataTemplate? SelectTemplateCore(object item,
|
||||
DependencyObject container) => SelectTemplateCore(item);
|
||||
DependencyObject container)
|
||||
{
|
||||
return SelectTemplateCore(item);
|
||||
}
|
||||
|
||||
private static DataTemplate CreateDataTemplate(IContentTemplateDescriptor descriptor)
|
||||
{
|
||||
string xamlString = @$"
|
||||
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
|
||||
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
|
||||
xmlns:local=""using:Toolkit.WinUI"">
|
||||
<local:TemplateControl />
|
||||
xmlns:ui=""using:{descriptor.TemplateType.Namespace}"">
|
||||
<ui:{descriptor.TemplateType.Name} />
|
||||
</DataTemplate>";
|
||||
|
||||
return (DataTemplate)XamlReader.Load(xamlString);
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Toolkit.WinUI;
|
||||
|
||||
public class PageControl :
|
||||
Page
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Page
|
||||
x:Class="Toolkit.WinUI.TemplatePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" />
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Toolkit.WinUI;
|
||||
|
||||
public sealed partial class TemplatePage : Page
|
||||
{
|
||||
public TemplatePage() => InitializeComponent();
|
||||
}
|
||||
@@ -15,6 +15,10 @@
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="TemplatePage.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
|
||||
@@ -24,5 +28,11 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Toolkit.Windows\Toolkit.Windows.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="TemplatePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user