我要删除的命名数据网格中有一个命名为textblock的行。鉴于我知道网格和行的名称,如何删除文本块?我希望找到类似的东西:

row_01.Delete();


但是没有这种运气。这是XAML:

<Grid Name="grid_01">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="10" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="10" />
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition Name="row_01" Height="10"/>
        <RowDefinition Name="row_02" Height="*" />
    </Grid.RowDefinitions>
    <Border BorderThickness="5" BorderBrush="Black" Grid.Row="1" Grid.Column="1">
        <TextBlock Grid.Column="1" Grid.Row="1"  Name="Tag_ContinueAs"  Text="Continue as Bejay" HorizontalAlignment="Center" />
    </Border>

最佳答案

为了删除行,请使用:

grid_01.RowDefinitions.Remove(row_01);

关于c# - 删除WPF C#中的命名行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45151711/

10-12 00:23
查看更多