mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
31 lines
1000 B
C#
31 lines
1000 B
C#
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);
|
|
}
|
|
}
|
|
}
|