|
-
Jul 5th, 2012, 12:45 PM
#1
Thread Starter
Lively Member
ListView style - MouseOver for Borders and Selected Items
Hi all,
I have the below XAML so far for a ListView.
There are two things that I cannot seem to get a handle on.
When a mouse hovers over the listview a small border is visible. How can I remove this? Is it part of the listview or the gridView for example.
My second question is, after the user chooses something, I check the choice in the code behind. If the choice is incorrect I would like to change the selected background color, or maybe remove the selection and make the text of this selection a red color. Could someone help me on this please.
Code:
<ListView Grid.Column="1" Height="250" HorizontalAlignment="Left" Margin="309,39,0,0"
Name="ListView1" VerticalAlignment="Top" Width="120" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ItemsSource="{Binding}" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Blue"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Green"/>
<Setter Property="BorderBrush" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView >
<GridView.ColumnHeaderContainerStyle>
<Style>
<Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Name="txtShortName" Text="{Binding shortname}" Margin="0"
TextAlignment="Center" FontFamily="Verdana"
FontSize="13" FontWeight="Bold" Width="100" Foreground="White">
<TextBlock.ToolTip>
<TextBlock Text="{Binding fullName}"/>
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="0">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Name="txtLogon" Text="{Binding logon}">
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|