Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: Style trigger not firing in wpf app

4 views
Skip to first unread message

Linda Liu[MSFT]

unread,
May 9, 2008, 6:45:25 AM5/9/08
to
Hi Moondaddy,

This is a quick note to let you know that I'm performing research on this
issue and will get back to you ASAP.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Linda Liu[MSFT]

unread,
May 12, 2008, 6:30:06 AM5/12/08
to
Hi Moondaddy,

After doing some research, I figure the problem out.

The main point is that the DataTrigger you use in the
"ConnectionGroupStyle" is not correct. You should use the relative source
mode of FindAncestor to get notified when the IsMouseOver property of the
parent element of the ChildControl changes.

In addition, in the SomeControl.xaml file, you shouldn't set the Visibility
property explicitly because it will override the style that is applied to
the element. You should set the initial value of the Visibility property in
the style.

The modifications are as follows.

1. In the Dictionary1.xaml:

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:StyleTriggerFromParent">

<Style x:Key="ConnectionGroupStyle" TargetType="{x:Type
c:ChildControl}">
<Setter Property="SnapsToDevicePixels" Value="false"/>
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Value="True">
<DataTrigger.Binding>
<Binding Path="IsMouseOver">
<Binding.RelativeSource>
<RelativeSource Mode="FindAncestor"
AncestorType="{x:Type FrameworkElement}" AncestorLevel="1"/>
</Binding.RelativeSource>
</Binding>
</DataTrigger.Binding>
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>

</ResourceDictionary>

2. In the SomeControl.xaml, remove the Visibility property from the
ChildControl element.

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.


moondaddy

unread,
May 16, 2008, 2:47:42 AM5/16/08
to
Your suggestion works. Thanks!

"Linda Liu[MSFT]" <v-l...@online.microsoft.com> wrote in message
news:09aaosBt...@TK2MSFTNGHUB02.phx.gbl...

Linda Liu[MSFT]

unread,
May 16, 2008, 3:24:58 AM5/16/08
to
Hi Moondaddy,

Thank you for your confirmation. I'm glad to hear that the problem is
solved now.

If you have any other questions in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance!

Have a nice weekend!

0 new messages