The border is not a container control so you cant add controls to it. I would try putting a StackPanel inside the border and add the DataGrid to the stackpanel.
Problem with improved DataGrid
Hello,
I have Page with BORDER
<Page
x:Class="DGT_TEST.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DGT_TEST"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Loaded="Page_Loaded"
>
<Grid>
<Border x:Name="brd1"></Border>
</Grid>
</Page>
In Loaded event I try to put to this border a DataGrid wich I improved a bit.
private void Page_Loaded(object sender, RoutedEventArgs e)
{
brd1.Child = new DGT<MyClass>();
}
public class DGT<T> : DataGrid
{
}
public class MyClass : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
}
But when I try to run this code in release mode, an error occurs.
How to pass this problem?