This is a migrated thread and some comments may be shown as answers.

Is it possible to trigger OnMouseOver style from xaml?

5 Answers 89 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 05 Dec 2016, 09:03 AM

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.

5 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 07 Dec 2016, 04:11 PM
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.
0
Tim
Top achievements
Rank 1
answered on 13 Dec 2016, 07:15 AM

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?

0
Dinko
Telerik team
answered on 16 Dec 2016, 07:06 AM
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.
0
Evgenia
Telerik team
answered on 16 Dec 2016, 03:56 PM
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.
0
Tim
Top achievements
Rank 1
answered on 06 Jan 2017, 02:07 PM

Hi Evgenia,

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

Regards.

Tags
Buttons
Asked by
Tim
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Tim
Top achievements
Rank 1
Dinko
Telerik team
Share this question
or