mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
Add chapter 10 sample project
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
using TemplateStudioSampleApp.Core.Models;
|
||||
|
||||
namespace TemplateStudioSampleApp.Views;
|
||||
|
||||
public sealed partial class ListDetailsDetailControl : UserControl
|
||||
{
|
||||
public SampleOrder? ListDetailsMenuItem
|
||||
{
|
||||
get => GetValue(ListDetailsMenuItemProperty) as SampleOrder;
|
||||
set => SetValue(ListDetailsMenuItemProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ListDetailsMenuItemProperty = DependencyProperty.Register("ListDetailsMenuItem", typeof(SampleOrder), typeof(ListDetailsDetailControl), new PropertyMetadata(null, OnListDetailsMenuItemPropertyChanged));
|
||||
|
||||
public ListDetailsDetailControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private static void OnListDetailsMenuItemPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ListDetailsDetailControl control)
|
||||
{
|
||||
control.ForegroundElement.ChangeView(0, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user