change the Foreground color when Hover on ListViewItem in a universal app

2 posts, 0 answers
  1. Imen
    Imen avatar
    8 posts
    Member since:
    Oct 2015

    Posted 14 Jan Link to this post

    Hi, 

    I am trying to set this Style to my ListViewItems when the Mouse hover on them:(attched file)

    Then,I did a Style when Mouse hover on every ListViewItem,but this Style changes the Background when Hover not the Foreground color ,this is my try

    <ListView Name="myList">

    <ListView.ItemContainerStyle>

    <Style TargetType="ListViewItem">

    <Setter Property="Template">

    <Setter.Value>

    <ControlTemplate TargetType="ListViewItem">

    <ListViewItemPresenter

            FocusSecondaryBorderBrush="#d9d7ec"

            PlaceholderBackground="#d9d7ec"

            PointerOverBackground="#d9d7ec"

            PointerOverForeground="#342d65"

            SelectedBackground="#d9d7ec"

            SelectedForeground="#342d65"

            SelectedPointerOverBackground="#d9d7ec"

            HorizontalContentAlignment="Stretch"

            VerticalContentAlignment="Center"

            Foreground="Gray" />

    </ControlTemplate>

    </Setter.Value>

    </Setter>

    </Style>

    </ListView.ItemContainerStyle>

    </ListView>

    and this is How I apply this Style to the ListView:

    <ListView >

    <ListView.ItemTemplate >

    <DataTemplate>

        <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">

              <TextBlock x:Name="day" Text="{Binding Path=day}" Foreground="#797978">

             </TextBlock>

       </StackPanel>

    </DataTemplate>

    </ListView.ItemTemplate >

    </ListView 

     So,please How can I change the Foreground color when Hover on ListViewItem

    thanks for help

     

     

  2. Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 19 Jan Link to this post

    Hi,

    Thank you for contacting us.

    Currently the only way to add visual effects on PointerOver, is to add the desired transition in the RadListViewItem's template.

    I hope this helps.

    Regards,
    Ivaylo Gergov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top