Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WPF';s的GridView有垂直边框吗?_Wpf_Gridview_Listview - Fatal编程技术网

WPF';s的GridView有垂直边框吗?

WPF';s的GridView有垂直边框吗?,wpf,gridview,listview,Wpf,Gridview,Listview,有没有办法在WPF GridView上设置垂直边框 以下内容适用于一些漂亮的水平边框。有没有一种好方法可以将垂直边框添加到此ListView中的GridView <Style x:Key="ListViewItemBase" TargetType="{x:Type ListViewItem}"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Val

有没有办法在WPF GridView上设置垂直边框

以下内容适用于一些漂亮的水平边框。有没有一种好方法可以将垂直边框添加到此ListView中的GridView

<Style x:Key="ListViewItemBase" TargetType="{x:Type ListViewItem}">
  <Setter Property="BorderThickness" Value="1" />
  <Setter Property="BorderBrush" Value="#BABABE" />
</Style>

提前感谢

试试这个。。。从


<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"                                            
            ContentTemplate="{TemplateBinding ContentTemplate}"
            KeyboardNavigation.DirectionalNavigation="Local"
            CanContentScroll="{TemplateBinding CanContentScroll}">

    <ScrollContentPresenter.Content>
        <Grid>
            <!-- Container of vertical and horizontal lines -->
            <ItemsControl Margin="3,0,0,0"
                          ItemsSource="{Binding Path=TemplatedParent.View.Columns,
                                        RelativeSource={RelativeSource TemplatedParent}}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border Width="{Binding Path=ActualWidth}"
                                BorderThickness="0,0,1,0"
                                BorderBrush="{DynamicResource verticalLineColor}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>

                <!-- Fill background with horizontal lines -->
                <ItemsControl.Background>
                    <VisualBrush TileMode="Tile"
                                 Stretch="None"
                                 Viewport="{Binding Source={StaticResource columnHeight},
                                            Converter={StaticResource columnViewportConverter}}"
                                 ViewportUnits="Absolute">
                        <VisualBrush.Visual>
                            <StackPanel HorizontalAlignment="Stretch"
                                        VerticalAlignment="Stretch">
                                <!-- Add Rectangles here for more horizontal lines -->
                                <Rectangle Height="{DynamicResource columnHeight}"
                                           VerticalAlignment="Stretch"
                                           Fill="{DynamicResource horizontalLineColor1}"
                                           Width="1" />
                                <Rectangle Height="{DynamicResource columnHeight}"
                                           VerticalAlignment="Stretch"
                                           Fill="{DynamicResource horizontalLineColor2}"
                                           Width="1"  />
                            </StackPanel>
                        </VisualBrush.Visual>
                    </VisualBrush>
                </ItemsControl.Background>        
            </ItemsControl>
            <ContentControl Content="{TemplateBinding Content}" />
        </Grid>
    </ScrollContentPresenter.Content>                                        
</ScrollContentPresenter>