C# WPF自定义网格不显示内容
我有一个从网格继承的控件C# WPF自定义网格不显示内容,c#,wpf,grid,C#,Wpf,Grid,我有一个从网格继承的控件 <Grid x:Class="User_Controls.CustomGrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/m
<Grid x:Class="User_Controls.CustomGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" x:Name="LayoutRoot"
>
<TextBlock>Test</TextBlock>
</Grid>
我在一个页面上的另一个网格中有一个CustomGrid实例
<Grid Grid.Column="4" Grid.Row="2" Style="{StaticResource MenuItemStyle}">
<src:LiveTile x:Name="liveTile1" />
</Grid>
当我运行项目时,文本字段中的值不会显示。我尝试过将控件从父网格中移除,弄乱字体和垂直/水平对齐
你知道为什么我看不到它的价值吗 如果使用TextBlock Grid.Column和Grid.Row属性,会发生什么?没有。我添加了行/列定义,并设置了textblock行/列。。。不太熟悉继承和WPF控件。。。。我猜LiveTile是CustomGrid定义的地方?我想我已经对它进行了排序。如果我创建一个继承grid的类,而不使用XAML,它将显示该值。为帮助干杯!
<Grid Grid.Column="4" Grid.Row="2" Style="{StaticResource MenuItemStyle}">
<src:LiveTile x:Name="liveTile1" />
</Grid>