Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8916029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:07:47+00:00 2026-06-15T05:07:47+00:00

I have a ListBox with an ItemTemplate (shown below) that when the mouse is

  • 0

I have a ListBox with an ItemTemplate (shown below) that when the mouse is over an item, a button is displayed that will fire a Delete Command.

This works, but what I’d like is for the button to “fade in” after the mouse has been over the listitem for a couple of seconds. How can I achieve this?

        <ListBox.ItemTemplate>
            <DataTemplate d:DesignSource="{d:DesignInstance quizCompanion:Question}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="40"></ColumnDefinition>
                        <ColumnDefinition Width="16"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="{Binding Path=Number}"></TextBlock>
                    <Button 
                        Content="x" Grid.Column="1"
                        Command=MyDeleteCommand>
                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Visibility" Value="Hidden"></Setter>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsMouseOver}" Value="True">
                                        <Setter Property="Visibility" Value="Visible" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
                </Grid>
            </DataTemplate>
        </ListBox.ItemTemplate>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:07:49+00:00Added an answer on June 15, 2026 at 5:07 am

    Try using a DataTrigger with a RelativeSource for the Binding.

    Here’s a sample … mouse over anywhere on the StackPanel for 2 seconds or more and the hidden button will fade in. It’ll disappear when the mouse is moved off. Hopefully it’ll work within your ListBox ItemTemplate:

    <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
       <Grid>
          <StackPanel Height="100" Background="Yellow">
             <TextBlock Text="Mouse over the yellow area to see the button"/>
             <Button Width="250" Height="50" HorizontalAlignment="Left" Opacity="0">
                <Button.Style>
                   <Style>
                      <Style.Triggers>
                         <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type StackPanel}}}" Value="True">
                            <DataTrigger.EnterActions>
                               <BeginStoryboard Name="Fade">
                                  <Storyboard>
                                     <DoubleAnimationUsingKeyFrames Duration="0:0:3" Storyboard.TargetProperty="Opacity">
                                        <LinearDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
                                        <LinearDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
                                     </DoubleAnimationUsingKeyFrames>
                                  </Storyboard>
                               </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                               <StopStoryboard BeginStoryboardName="Fade"/>
                            </DataTrigger.ExitActions>
                         </DataTrigger>
                      </Style.Triggers>
                   </Style>
                </Button.Style>
             </Button>
          </StackPanel>
       </Grid>
    </Page>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data bound Listbox as shown below. I want the textblock that
So I have this Xaml inside a ListBox Item Template: <ListBox.ItemTemplate> <DataTemplate> <Grid Height=22
I have a listbox item template that contains visual states. I have DisplayStateBehaviors that
I have a page that has a listbox with the following item template as
I have a ListBox with a DataTemplate that looks like this: <ListBox Name=listBox> <ListBox.ItemTemplate>
I have a listbox and I have set the itemstemplate as shown below. XAML:
I have a UserControl (XAML below) that has a ListBox that I want to
I have a ListBox bound to an ObservableCollection, and inside the ListBox.ItemTemplate I have
I have a ListBox with an ItemTemplate consisting of a TextBlock and a ComboBox
So I have the following DataTemplate for a ListBox.ItemTemplate : <DataTemplate x:Key=Tweet> <Grid> <Grid.ColumnDefinitions>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.