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