开发者

WPF ListView/GridView Highlight Color

XAML

    <ListView Name="Panel"
              Width="Auto"
              Margin="0,200,0,0"
              HorizontalAlignment="Stretch"
              VerticalAlignment="Stretch"
              Background="{x:Null}"
              BorderThickness="0"
              ItemsSource="{Binding Source={x:Static Communicator:Profile.AvailableFriends}}"
              MouseDoubleClick="Panel_MouseDoubleClick"
              ScrollViewer.HorizontalScrollBarVisibility="Disabled"
              SelectionMode="Single">
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <WrapPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
        <ListView.View>
            <GridView ColumnHeaderContainerStyle="{StaticResource HiddenStyle}">
                <GridViewColumn Width="Auto">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Border Canvas.Left="55"
                                    Canvas.Top="30"
                                    Width="50"
                                    Height="50"
                                    Margin="0,5"
                                    BorderBrush="#FF3E5998"
                                    BorderThickness=".25"
                                    CornerRadius="9">
                                <Border.Effect>
                                    <DropShadowEffect BlurRadius="5"
                                                      Opacity=".5"
                                                      ShadowDepth="3" />
                                </Border.Effect>
                                <Border BorderBrush="{Binding Color}"
                                        BorderThickness="3"
                                        CornerRadius="7.5">
                                    <Border BorderBrush="#FF3B5998"
                                            BorderThickness=".25"
                                            CornerRadius="6.5">
                                        <Border.Background>
                                            <ImageBrush ImageSource="{Binding Picture}" />
                                        </Border.Background>
                                    </Border>
                                </Border>
                            </Border>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <开发者_JS百科;GridViewColumn Width="Auto">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <Label Content="{Binding Name}" />
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
            </GridView>
        </ListView.View>
    </ListView>

How To :

1 - Change Highlight Color for Mouse-Hover Item

2 - Change Highlight Color for Selected Item

3 - Change Highlight Color for Losed-Focus-Selected Item

Note :

I tried alot to change colors but GRIDVIEW always forces its own :S


You need to change ListViewItem template.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜