Is it possible to trigger OnMouseOver style from xaml?

6 posts, 0 answers
  1. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 05 Dec 2016 Link to this post

    Is it possible to trigger OnMouseOver style depending of another control OnMouseOver state?
    Specifically I would like to trigger OnMouseOver style on a RadButton when user hovers a RadComboBox.

  2. Evgenia
    Admin
    Evgenia avatar
    1435 posts

    Posted 07 Dec 2016 Link to this post

    Hi Ivo,

    I'm assuming that currently the RadButton you are mentioning is inside the ControlTemplate of the RadComboBox. On MouseOver of the RadComboBox you want to make sure that ToggleButton knows this and changes accordingly like it has being hovered directly. You can achieve this fairly easy with the use of DataTrigger (for example we'll change the Foreground of the Button):

    <Style.Triggers>
               <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type RadComboBox}}, Path=IsMouseOver}" Value="True">
                   <Setter Property="Background" Value="Red" />
               </DataTrigger >
           </Style.Triggers>

    Regards,
    Evgenia
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 13 Dec 2016 in reply to Evgenia Link to this post

    Hi Evgenia,

    Thank you for you answer. What I actually would like is to trigger control's built-in OnMouseOver Style so the when I change the theme, OnMouseOver style is consistent. Not to change the Background to another color like in your example. Is that possible?

  4. Dinko
    Admin
    Dinko avatar
    266 posts

    Posted 16 Dec 2016 Link to this post

    Hi Ivo,

    We need more time to check your scenario. We will contact you again as soon as we have more information about your case.

    Regards,
    Dinko
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Evgenia
    Admin
    Evgenia avatar
    1435 posts

    Posted 16 Dec 2016 Link to this post

    Hi Ivo,

    You might find attached a sample project that I believe does what you required. Some notes about it -- please add NoXAML binaries reference to the project to be able to run it as it is made to be used with our implicit styles theming mechanism. It will definwetely work on changing themes runtime as well. Give it a try and let us know how it works for you.

    Regards,
    Evgenia
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  6. Ivo
    Ivo avatar
    48 posts
    Member since:
    Jul 2011

    Posted 06 Jan in reply to Evgenia Link to this post

    Hi Evgenia,

    Your solution works perfectly even with the normal libs (currently we are using those).

    Regards.

Back to Top