如何在WPF中为GridView的行定义样式

时间:2014-02-19 12:12:17

标签: c# xaml

我正在设计一个嵌套在ListView中的GridView。一切都很好,但我想在GridView的Row上应用一些样式,但在xaml中找不到预定义的GridViewRow标记。

实际上我想在每行的边框处显示衬里,以便将其分开显示。

<ListView  x:Name="gridTopics" BorderThickness="2" ItemsSource="{Binding Path=TOPICSINFO}" HorizontalAlignment="Left" Margin="91,79,0,0" VerticalAlignment="Top" Height="242" Width="310" BorderBrush="#FF32A3D6">
        <ListView.Effect>
            <DropShadowEffect Color="#FF9ADDFB" />
        </ListView.Effect>
        <ListView.View>
            <GridView x:Name="GridViewControl">
                <GridView.Columns>
                    <GridViewColumn  x:Name="colPageNo" DisplayMemberBinding="{Binding PAGENO}" Width="50" Header="Pages" />
                    <GridViewColumn x:Name="colListTopics" Width="241" Header="Suggested Topics">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <ComboBox x:Name="colTopics" ItemsSource="{Binding LISTTOPICS}"
                                          SelectedIndex="0"
 />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView.Columns>

            </GridView>
        </ListView.View>
    </ListView>

1 个答案:

答案 0 :(得分:0)

您希望使用GridPanel执行此操作,它将允许您定义行和列的样式。

http://wpftutorial.net/GridLayout.html