Solved

WPF Boolean Attached Properties and the property changed callback

Posted on 2014-01-12
1
589 Views
Last Modified: 2014-01-12
c#:

namespace AttachedProperties
{
   public class MyNominalObject :DependencyObject
   {
       public static readonly DependencyProperty UseMouseLeaveProperty =
           DependencyProperty.RegisterAttached("UseMouseLeave", typeof (Boolean), typeof (MyNominalObject), new PropertyMetadata(OnUsingMouseLeave));

       private static void OnUsingMouseLeave(DependencyObject d, DependencyPropertyChangedEventArgs e)
       {
           var result = d.GetValue(UseMouseLeaveProperty);
       }

        public static void SetUseMouseLeave(UIElement element, bool value)
       {
           element.SetValue(UseMouseLeaveProperty, value);
       }

       public static bool GetUseMouseLeave(UIElement element)
       {
           return (bool) element.GetValue(UseMouseLeaveProperty);
       }
    }

xaml:
       <ListBox local:MyNominalObject.UseMouseLeave="True">
            <ListBox.Items>
                <ListBoxItem Content="1" />
            </ListBox.Items>
        </ListBox>    


Question:
Why is a breakpoint hit on " var result = d.GetValue(UseMouseLeaveProperty); " when the xaml is local:MyNominalObject.UseMouseLeave="True",

but the breakpoint is not hit it the xaml is:
 local:MyNominalObject.UseMouseLeave="False",
0
Comment
Question by:quentinA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
quentinA earned 0 total points
ID: 39774704
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question