网格列边框 UWP

Grid Column Border UWP

我有以下代码:

<ListView x:Name="lstSync" Margin="0,240,0,110" ItemsSource="{x:Bind Path=ViewModel.SyncItems}" ItemClick="gridViewAll_ItemClick" IsItemClickEnabled="True" SelectionMode="None">
    <ListView.Resources>
        <mAppV2:BoolConverter x:Key="Converter1"/>
    </ListView.Resources>
    <ListView.ItemTemplate>
        <DataTemplate x:DataType="mAppV2:SyncItem">
            <Grid Height="50" Background="White" Margin="0" HorizontalAlignment="Stretch" BorderBrush="#FF2E8FDD" BorderThickness="0,0,0,1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="50" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{x:Bind name}" FontSize="11" Grid.Column="0" x:Phase="1" Margin="5" VerticalAlignment="Center" Foreground="#FF044071"/>
                <CheckBox IsChecked="{Binding isChecked, Mode=TwoWay, Converter={StaticResource Converter1}}" Grid.Column="1" Margin="4" VerticalAlignment="Center" Width="45" Height="45" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked">
                    <ContentControl>
                        <Image Source="Assets/unchecked_checkbox.png"/>
                    </ContentControl>
                </CheckBox>
            </Grid>
        </DataTemplate>
    </ListView.ItemTemplate>
    <ListView.ItemContainerStyle>
        <Style TargetType="ListViewItem">
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">
                        <ListViewItemPresenter ContentMargin="0" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ListView.ItemContainerStyle>
</ListView>

我的问题是我想在 Grid 中的 TextBlock 的右边有一个边框,但是 TextBlock 没有边框 属性。

有人知道如何实现吗? 谢谢。

是的,TextBlock 没有边框 属性。您必须像这样使用边框控件:

<Border BorderThickness="1">
    <TextBlock Text="abc" />
</Border>

它的工作原理与 WPF 中的相同。这是一个教程:http://www.wpf-tutorial.com/misc-controls/the-border-control/