About
Pricing
Community
Teams
Start Free Trial
Log in
quentinA
asked on
1/12/2014
WPF Boolean Attached Properties and the property changed callback
c#:
namespace AttachedProperties
{
public class MyNominalObject :DependencyObject
{
public static readonly DependencyProperty UseMouseLeaveProperty =
DependencyProperty.Registe
rAttached(
"UseMouseL
eave", typeof (Boolean), typeof (MyNominalObject), new PropertyMetadata(OnUsingMo
useLeave))
;
private static void OnUsingMouseLeave(Dependen
cyObject d, DependencyPropertyChangedE
ventArgs e)
{
var result = d.GetValue(UseMouseLeavePr
operty);
}
public static void SetUseMouseLeave(UIElement
element, bool value)
{
element.SetValue(UseMouseL
eaveProper
ty, value);
}
public static bool GetUseMouseLeave(UIElement
element)
{
return (bool) element.GetValue(UseMouseL
eaveProper
ty);
}
}
xaml:
<ListBox local:MyNominalObject.UseM
ouseLeave=
"True">
<ListBox.Items>
<ListBoxItem Content="1" />
</ListBox.Items>
</ListBox>
Question:
Why is a breakpoint hit on " var result = d.GetValue(UseMouseLeavePr
operty); " when the xaml is local:MyNominalObject.UseM
ouseLeave=
"True",
but the breakpoint is not hit it the xaml is:
local:MyNominalObject.UseM
ouseLeave=
"False",
.NET Programming
C#
Microsoft Development
1
1
Last Comment
quentinA
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
quentinA
1/12/2014
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes