我很难在Blend for VS 2015中为ListView设计样式。
到目前为止,我试图删除边框但没有成功。 老实说,我不知道要编辑哪个控件,因为我是XAML和Blend的新手。 另外,如果我想编辑文本样式和边距,我还需要查看哪些内容?
任何提示都会非常有用!
编辑:这是我目前的模板。 (目前没有添加任何样式)
<ListView x:Name="osebe_listView" Margin="0,0,40,0" SelectionMode="Multiple" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" SelectionChanged="osebe_lw_SelectionChanged">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding visible}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.Resources>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="#1AFFFFFF" />
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style TargetType="{x:Type ColumnDefinition}">
<Setter Property="Width" Value="10"/>
</Style>
</ListView.Resources>
<ListView.Background>
<VisualBrush>
<VisualBrush.Visual>
<Canvas>
<Path Opacity="0.3" Fill="#ffffffff" Data="F1 M 1284.873,520.501 C 1284.873,520.501 624.468,520.501 398.000,520.501 C 357.500,520.501 317.795,532.191 321.482,568.667 C 324.750,601.000 376.000,615.067 376.000,615.067 C 376.000,615.067 334.939,618.238 269.047,597.756 C 235.250,587.250 196.701,555.682 160.000,539.000 C 127.000,524.000 96.000,520.501 60.615,520.501 C 50.487,520.501 25.106,520.501 25.106,520.501 C 15.756,520.501 8.106,512.851 8.106,503.501 L 8.106,25.279 C 8.106,15.929 15.756,8.279 25.106,8.279 L 1284.873,8.279 C 1294.223,8.279 1301.873,15.929 1301.873,25.279 L 1301.873,503.501 C 1301.873,512.851 1294.223,520.501 1284.873,520.501 Z"/>
</Canvas>
</VisualBrush.Visual>
</VisualBrush>
</ListView.Background>
<ListView.View>
<GridView>
<GridViewColumn Header="Naziv podjetja" DisplayMemberBinding="{Binding nazivPodjetja}"/>
<GridViewColumn Header="Ime" DisplayMemberBinding="{Binding ime}" Width="25"/>
<GridViewColumn Header="Priimek" DisplayMemberBinding="{Binding priimek}" Width="{Binding ActualWidth, ElementName=helperField}"/>
<GridViewColumn Header="Naslov" DisplayMemberBinding="{Binding naslov}" Width="{Binding ActualWidth, ElementName=helperField}"/>
<GridViewColumn Header="Pošta" DisplayMemberBinding="{Binding posta}" Width="{Binding ActualWidth, ElementName=helperField}"/>
<GridViewColumn Header="Mobilna številka" DisplayMemberBinding="{Binding mobilnaSt}" Width="{Binding ActualWidth, ElementName=helperField}"/>
<GridViewColumn Header="Stacionarna številka" DisplayMemberBinding="{Binding stacionarnaSt}" Width="{Binding ActualWidth, ElementName=helperField}"/>
<GridViewColumn Header="E-naslov" DisplayMemberBinding="{Binding eMail}" Width="{Binding ActualWidth, ElementName=helperField}"/>
<GridViewColumn Header="Skupina" DisplayMemberBinding="{Binding skupina}" Width="{Binding ActualWidth, ElementName=helperField}"/>
</GridView>
</ListView.View>
</ListView>
答案 0 :(得分:2)
您需要覆盖ControlTemplate
的{{1}}。
您可以通过右键单击Blend中的GridViewColumnHeader
元素来复制默认模板,然后选择编辑模板 - >编辑副本,然后根据您的要求进行修改:
GridViewColumnHeader