Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WPF Boolean Attached Properties and the property changed callback

Posted on 2014-01-12
1
Medium Priority
?
613 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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