CustomControls (проект библиотеки классов Winui3) )/CustomTableItem.cs
Код: Выделить всё
namespace CustomControls
{
public sealed class CustomTableItem : Control
{
DependencyProperty TableNameProperty = DependencyProperty.Register(
nameof(TableName),
typeof(string),
typeof(CustomTableItem),
new PropertyMetadata(null));
public string TableName
{
get => (string)GetValue(TableNameProperty);
set => SetValue(TableNameProperty, value);
}
public CustomTableItem()
{
this.DefaultStyleKey = typeof(CustomTableItem);
}
public CustomTableItem(string TableName)
{
this.DefaultStyleKey = typeof(CustomTableItem);
this.TableName = TableName;
}
}
}
Код: Выделить всё
//one other style above [...]
Код: Выделить всё
x:Class="View.CustomTablePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:View"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:customControls ="using:CustomControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Конечный результат:

Когда я размещаю точно такой же элемент управления на странице, экземпляр которой создается один раз и используется повторно(
Код: Выделить всё
ContentFrame.Content = PageObject
Расположение другой страницы: View/PageName.xaml.
Код:
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/790 ... oesnt-work