我想更改每列的字体大小。我正在使用Gridview的listview。我希望结果像这样:
这是我的XML代码:
<ListView x:Name="listView1" Margin="0,0,-5,-5" FontSize="20">
<ListView.View>
<GridView>
<GridViewColumn Header="Column1" DisplayMemberBinding="{Binding c1}" />
<GridViewColumn Header="Column2" DisplayMemberBinding="{Binding c2}" Width="780"/>
<GridViewColumn Header="Column3" DisplayMemberBinding="{Binding c3}" Width="460"/>
</GridView>
</ListView.View>
</ListView>
C#:
this.listView1.Items.Add(new MyItem { c1= "This is Column 1 Row 1 Text", c2="This is Column 2 Row 1 Text", c3= "This is Column 3 Row 1 Text" });
class MyItem
{
public string c1{ get; set; }
public string c2{ get; set; }
public string c3{ get; set; }
}
答案 0 :(得分:4)
您始终可以使用CellTemplate
代替DisplayMemberBinding
来获得完整的自定义选项。
对于第一列,例如:
<GridViewColumn Header="Column1">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding c1}" FontSize="15px"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>