Results 1 to 2 of 2

Thread: [RESOLVED] Mouse Over item in listbox trigger

  1. #1

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Resolved [RESOLVED] Mouse Over item in listbox trigger

    Hi guys,

    I am experimenting with listbox customization and although it was going quite smoothly I have now hit a stumbling block that is annoying me like mad.

    Basically, all I want to do is make it so that when the mouse passes over an item in the listbox, an animation is triggered. However, I thought I would start out simple and just make it so that instead of kicking off an animation, it just adjusts the opacity level of the item that is being hovered over.

    This is proving to be a bit of a nightmare though...
    Basically I have a DataTemplate that I am using for the ItemTemplate property of the ListBox, so that I can display some images with borders and reflections in the listbox. So I figured I just needed to add a trigger to that datatemplate and after countless different attempts this is what I ended up 'borrowing' from someone else on the internet, but it still doesnt work! No errors or anything, it just doesnt adjust the opacity of the item that the mouse is over:
    xml Code:
    1. <DataTemplate.Triggers>
    2.                 <DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource TemplatedParent}}"
    3.                                  Value="True">
    4.                     <Setter Property="Opacity" Value="1" />
    5.                 </DataTrigger>
    6. </DataTemplate.Triggers>

    Am I going about this the wrong way? I'm totally confused! Any suggestions appreciated.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  2. #2

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [RESOLVED] Mouse Over item in listbox trigger

    Nevermind, got it working using the following:

    xml Code:
    1. <DataTemplate.Triggers>
    2.                 <Trigger SourceName="ImageContainer" Property="IsMouseOver" Value="True">
    3.                     <Setter TargetName="ActualImage" Property="Opacity" Value="1" />
    4.                 </Trigger>
    5. </DataTemplate.Triggers>
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width