0
我试图创建一个3个文本行WPF列表视图,但右边框设置不正确(由围绕1-3像素 right border切断。左手边是罚款。WPF ListView控件右边框切断
<Window x:Class="ListViewBorder.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ListViewBorder"
mc:Ignorable="d"
x:Name="MainWindowUc"
Title="MainWindow" Height="800" Width="1024">
<Grid>
<ListView
ItemsSource="{Binding ElementName=MainWindowUc, Path=Items}"
BorderBrush="DarkCyan"
BorderThickness="1" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
>
<ListView.ItemTemplate>
<DataTemplate>
<Border Background="DarkGray"
BorderBrush="Blue"
BorderThickness="2"
CornerRadius="6"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}">
<WrapPanel Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=Border}}"
>
<TextBlock Padding="1" Text="{Binding Column1}" Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=WrapPanel}}" TextWrapping="NoWrap"></TextBlock>
<TextBlock Padding="1" Text="{Binding Column2}" Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=WrapPanel}}" TextWrapping="Wrap"></TextBlock>
<TextBlock Padding="1" Text="{Binding Column3}" Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=WrapPanel}}" TextWrapping="Wrap" TextAlignment="Right"></TextBlock>
</WrapPanel>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
如何“修理”这个
工程....谢谢 – Indy68