Callback when dependency property recieves xaml change












1















When I set the value of IsClosed during runtime, OnIsClosedChanged() is called fine.
However, the Designer sets the value of the property but does not call the OnIsClosedChanged().



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
if ((bool)this.GetValue(IsClosedProperty) == value)
return;

this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


Obviously IsClosed is not modified by the Designer and only IsClosedProperty receives the xaml change.

My question is: How can I run IsClosed after the value has been modified in the Designer. Or at least add some logic to the non-runtime changes.










share|improve this question




















  • 2





    Did you try to play around with ValidateValueCallback? Use overloaded method of DependencyProperty.Register msdn.microsoft.com/en-us/library/ms597501(v=vs.110).aspx

    – Alexander Kozlov
    Feb 3 '15 at 15:04











  • I've made same mistake some time ago. Dependency property is something what is deep. The property only exposes it for you, but WPF doesn't uses your property (you can delete it). And @AlexK, comment is right (it could be the answer), use callback to get notified when dependency property (not to be mistaken with your property) is changed by UI (by designer, by user in run-time, etc).

    – Sinatr
    Feb 3 '15 at 15:09


















1















When I set the value of IsClosed during runtime, OnIsClosedChanged() is called fine.
However, the Designer sets the value of the property but does not call the OnIsClosedChanged().



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
if ((bool)this.GetValue(IsClosedProperty) == value)
return;

this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


Obviously IsClosed is not modified by the Designer and only IsClosedProperty receives the xaml change.

My question is: How can I run IsClosed after the value has been modified in the Designer. Or at least add some logic to the non-runtime changes.










share|improve this question




















  • 2





    Did you try to play around with ValidateValueCallback? Use overloaded method of DependencyProperty.Register msdn.microsoft.com/en-us/library/ms597501(v=vs.110).aspx

    – Alexander Kozlov
    Feb 3 '15 at 15:04











  • I've made same mistake some time ago. Dependency property is something what is deep. The property only exposes it for you, but WPF doesn't uses your property (you can delete it). And @AlexK, comment is right (it could be the answer), use callback to get notified when dependency property (not to be mistaken with your property) is changed by UI (by designer, by user in run-time, etc).

    – Sinatr
    Feb 3 '15 at 15:09
















1












1








1


2






When I set the value of IsClosed during runtime, OnIsClosedChanged() is called fine.
However, the Designer sets the value of the property but does not call the OnIsClosedChanged().



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
if ((bool)this.GetValue(IsClosedProperty) == value)
return;

this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


Obviously IsClosed is not modified by the Designer and only IsClosedProperty receives the xaml change.

My question is: How can I run IsClosed after the value has been modified in the Designer. Or at least add some logic to the non-runtime changes.










share|improve this question
















When I set the value of IsClosed during runtime, OnIsClosedChanged() is called fine.
However, the Designer sets the value of the property but does not call the OnIsClosedChanged().



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
if ((bool)this.GetValue(IsClosedProperty) == value)
return;

this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


Obviously IsClosed is not modified by the Designer and only IsClosedProperty receives the xaml change.

My question is: How can I run IsClosed after the value has been modified in the Designer. Or at least add some logic to the non-runtime changes.







c# wpf xaml dependency-properties






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 14 '15 at 14:19









Tim Pohlmann

1,8701542




1,8701542










asked Feb 3 '15 at 14:50









Noel WidmerNoel Widmer

2,42343246




2,42343246








  • 2





    Did you try to play around with ValidateValueCallback? Use overloaded method of DependencyProperty.Register msdn.microsoft.com/en-us/library/ms597501(v=vs.110).aspx

    – Alexander Kozlov
    Feb 3 '15 at 15:04











  • I've made same mistake some time ago. Dependency property is something what is deep. The property only exposes it for you, but WPF doesn't uses your property (you can delete it). And @AlexK, comment is right (it could be the answer), use callback to get notified when dependency property (not to be mistaken with your property) is changed by UI (by designer, by user in run-time, etc).

    – Sinatr
    Feb 3 '15 at 15:09
















  • 2





    Did you try to play around with ValidateValueCallback? Use overloaded method of DependencyProperty.Register msdn.microsoft.com/en-us/library/ms597501(v=vs.110).aspx

    – Alexander Kozlov
    Feb 3 '15 at 15:04











  • I've made same mistake some time ago. Dependency property is something what is deep. The property only exposes it for you, but WPF doesn't uses your property (you can delete it). And @AlexK, comment is right (it could be the answer), use callback to get notified when dependency property (not to be mistaken with your property) is changed by UI (by designer, by user in run-time, etc).

    – Sinatr
    Feb 3 '15 at 15:09










2




2





Did you try to play around with ValidateValueCallback? Use overloaded method of DependencyProperty.Register msdn.microsoft.com/en-us/library/ms597501(v=vs.110).aspx

– Alexander Kozlov
Feb 3 '15 at 15:04





Did you try to play around with ValidateValueCallback? Use overloaded method of DependencyProperty.Register msdn.microsoft.com/en-us/library/ms597501(v=vs.110).aspx

– Alexander Kozlov
Feb 3 '15 at 15:04













I've made same mistake some time ago. Dependency property is something what is deep. The property only exposes it for you, but WPF doesn't uses your property (you can delete it). And @AlexK, comment is right (it could be the answer), use callback to get notified when dependency property (not to be mistaken with your property) is changed by UI (by designer, by user in run-time, etc).

– Sinatr
Feb 3 '15 at 15:09







I've made same mistake some time ago. Dependency property is something what is deep. The property only exposes it for you, but WPF doesn't uses your property (you can delete it). And @AlexK, comment is right (it could be the answer), use callback to get notified when dependency property (not to be mistaken with your property) is changed by UI (by designer, by user in run-time, etc).

– Sinatr
Feb 3 '15 at 15:09














2 Answers
2






active

oldest

votes


















7














You would have to register a PropertyChangedCallback with property metadata.



The reason is that dependency properties set in XAML or by bindings or some other source do not invoke the CLR wrapper (the setter method). The reason is explained in the XAML Loading and Dependency Properties article on MSDN:




For implementation reasons, it is computationally less expensive to
identify a property as a dependency property and access the property
system SetValue method to set it, rather than using the property
wrapper and its setter.



...



Because the current WPF implementation of the XAML processor behavior
for property setting bypasses the wrappers entirely, you should not
put any additional logic into the set definitions of the wrapper for
your custom dependency property. If you put such logic in the set
definition, then the logic will not be executed when the property is
set in XAML rather than in code.




Your code should look like this:



public static readonly DependencyProperty IsClosedProperty =
DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(GroupBox),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender,
(o, e) => ((GroupBox)o).OnIsClosedChanged()));

public bool IsClosed
{
get { return (bool)GetValue(IsClosedProperty); }
set { SetValue(IsClosedProperty, value); }
}

private void OnIsClosedChanged()
{
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}





share|improve this answer


























  • Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

    – Noel Widmer
    Feb 3 '15 at 15:19



















1














Found the answer myself now. ValidateValueCallback comes really close! (as Alex K has pointed out) But it is a static method and I don't get any reference to the instance which has been changed. The key is to use a PropertyChangedCallback in FrameworkPropertyMetadata which is also an argument passed to the Property.Register method.

See:



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnIsClosedChangedPCC)));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private static void OnIsClosedChangedPCC(DependencyObject d, DependencyPropertyChangedEventArgs e) {
GroupBox current = (GroupBox)d;
current.IsClosed = current.IsClosed;
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


That does now re-set the IsClosedValue which triggers the OnIsClosedChanged to run.

Thank's for your help guys!






share|improve this answer
























  • Right. I meant PropertyChangedCallback of course =)

    – Alexander Kozlov
    Feb 3 '15 at 15:17






  • 1





    Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

    – Clemens
    Feb 3 '15 at 15:18













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28301783%2fcallback-when-dependency-property-recieves-xaml-change%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














You would have to register a PropertyChangedCallback with property metadata.



The reason is that dependency properties set in XAML or by bindings or some other source do not invoke the CLR wrapper (the setter method). The reason is explained in the XAML Loading and Dependency Properties article on MSDN:




For implementation reasons, it is computationally less expensive to
identify a property as a dependency property and access the property
system SetValue method to set it, rather than using the property
wrapper and its setter.



...



Because the current WPF implementation of the XAML processor behavior
for property setting bypasses the wrappers entirely, you should not
put any additional logic into the set definitions of the wrapper for
your custom dependency property. If you put such logic in the set
definition, then the logic will not be executed when the property is
set in XAML rather than in code.




Your code should look like this:



public static readonly DependencyProperty IsClosedProperty =
DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(GroupBox),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender,
(o, e) => ((GroupBox)o).OnIsClosedChanged()));

public bool IsClosed
{
get { return (bool)GetValue(IsClosedProperty); }
set { SetValue(IsClosedProperty, value); }
}

private void OnIsClosedChanged()
{
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}





share|improve this answer


























  • Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

    – Noel Widmer
    Feb 3 '15 at 15:19
















7














You would have to register a PropertyChangedCallback with property metadata.



The reason is that dependency properties set in XAML or by bindings or some other source do not invoke the CLR wrapper (the setter method). The reason is explained in the XAML Loading and Dependency Properties article on MSDN:




For implementation reasons, it is computationally less expensive to
identify a property as a dependency property and access the property
system SetValue method to set it, rather than using the property
wrapper and its setter.



...



Because the current WPF implementation of the XAML processor behavior
for property setting bypasses the wrappers entirely, you should not
put any additional logic into the set definitions of the wrapper for
your custom dependency property. If you put such logic in the set
definition, then the logic will not be executed when the property is
set in XAML rather than in code.




Your code should look like this:



public static readonly DependencyProperty IsClosedProperty =
DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(GroupBox),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender,
(o, e) => ((GroupBox)o).OnIsClosedChanged()));

public bool IsClosed
{
get { return (bool)GetValue(IsClosedProperty); }
set { SetValue(IsClosedProperty, value); }
}

private void OnIsClosedChanged()
{
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}





share|improve this answer


























  • Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

    – Noel Widmer
    Feb 3 '15 at 15:19














7












7








7







You would have to register a PropertyChangedCallback with property metadata.



The reason is that dependency properties set in XAML or by bindings or some other source do not invoke the CLR wrapper (the setter method). The reason is explained in the XAML Loading and Dependency Properties article on MSDN:




For implementation reasons, it is computationally less expensive to
identify a property as a dependency property and access the property
system SetValue method to set it, rather than using the property
wrapper and its setter.



...



Because the current WPF implementation of the XAML processor behavior
for property setting bypasses the wrappers entirely, you should not
put any additional logic into the set definitions of the wrapper for
your custom dependency property. If you put such logic in the set
definition, then the logic will not be executed when the property is
set in XAML rather than in code.




Your code should look like this:



public static readonly DependencyProperty IsClosedProperty =
DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(GroupBox),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender,
(o, e) => ((GroupBox)o).OnIsClosedChanged()));

public bool IsClosed
{
get { return (bool)GetValue(IsClosedProperty); }
set { SetValue(IsClosedProperty, value); }
}

private void OnIsClosedChanged()
{
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}





share|improve this answer















You would have to register a PropertyChangedCallback with property metadata.



The reason is that dependency properties set in XAML or by bindings or some other source do not invoke the CLR wrapper (the setter method). The reason is explained in the XAML Loading and Dependency Properties article on MSDN:




For implementation reasons, it is computationally less expensive to
identify a property as a dependency property and access the property
system SetValue method to set it, rather than using the property
wrapper and its setter.



...



Because the current WPF implementation of the XAML processor behavior
for property setting bypasses the wrappers entirely, you should not
put any additional logic into the set definitions of the wrapper for
your custom dependency property. If you put such logic in the set
definition, then the logic will not be executed when the property is
set in XAML rather than in code.




Your code should look like this:



public static readonly DependencyProperty IsClosedProperty =
DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(GroupBox),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender,
(o, e) => ((GroupBox)o).OnIsClosedChanged()));

public bool IsClosed
{
get { return (bool)GetValue(IsClosedProperty); }
set { SetValue(IsClosedProperty, value); }
}

private void OnIsClosedChanged()
{
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}






share|improve this answer














share|improve this answer



share|improve this answer








edited May 9 '15 at 4:58

























answered Feb 3 '15 at 15:16









ClemensClemens

89.2k889180




89.2k889180













  • Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

    – Noel Widmer
    Feb 3 '15 at 15:19



















  • Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

    – Noel Widmer
    Feb 3 '15 at 15:19

















Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

– Noel Widmer
Feb 3 '15 at 15:19





Clemens once again! Found the answer myself a couple minutes ago. But the reference is interesting though... Thx :)

– Noel Widmer
Feb 3 '15 at 15:19













1














Found the answer myself now. ValidateValueCallback comes really close! (as Alex K has pointed out) But it is a static method and I don't get any reference to the instance which has been changed. The key is to use a PropertyChangedCallback in FrameworkPropertyMetadata which is also an argument passed to the Property.Register method.

See:



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnIsClosedChangedPCC)));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private static void OnIsClosedChangedPCC(DependencyObject d, DependencyPropertyChangedEventArgs e) {
GroupBox current = (GroupBox)d;
current.IsClosed = current.IsClosed;
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


That does now re-set the IsClosedValue which triggers the OnIsClosedChanged to run.

Thank's for your help guys!






share|improve this answer
























  • Right. I meant PropertyChangedCallback of course =)

    – Alexander Kozlov
    Feb 3 '15 at 15:17






  • 1





    Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

    – Clemens
    Feb 3 '15 at 15:18


















1














Found the answer myself now. ValidateValueCallback comes really close! (as Alex K has pointed out) But it is a static method and I don't get any reference to the instance which has been changed. The key is to use a PropertyChangedCallback in FrameworkPropertyMetadata which is also an argument passed to the Property.Register method.

See:



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnIsClosedChangedPCC)));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private static void OnIsClosedChangedPCC(DependencyObject d, DependencyPropertyChangedEventArgs e) {
GroupBox current = (GroupBox)d;
current.IsClosed = current.IsClosed;
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


That does now re-set the IsClosedValue which triggers the OnIsClosedChanged to run.

Thank's for your help guys!






share|improve this answer
























  • Right. I meant PropertyChangedCallback of course =)

    – Alexander Kozlov
    Feb 3 '15 at 15:17






  • 1





    Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

    – Clemens
    Feb 3 '15 at 15:18
















1












1








1







Found the answer myself now. ValidateValueCallback comes really close! (as Alex K has pointed out) But it is a static method and I don't get any reference to the instance which has been changed. The key is to use a PropertyChangedCallback in FrameworkPropertyMetadata which is also an argument passed to the Property.Register method.

See:



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnIsClosedChangedPCC)));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private static void OnIsClosedChangedPCC(DependencyObject d, DependencyPropertyChangedEventArgs e) {
GroupBox current = (GroupBox)d;
current.IsClosed = current.IsClosed;
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


That does now re-set the IsClosedValue which triggers the OnIsClosedChanged to run.

Thank's for your help guys!






share|improve this answer













Found the answer myself now. ValidateValueCallback comes really close! (as Alex K has pointed out) But it is a static method and I don't get any reference to the instance which has been changed. The key is to use a PropertyChangedCallback in FrameworkPropertyMetadata which is also an argument passed to the Property.Register method.

See:



public static DependencyProperty IsClosedProperty = DependencyProperty.Register("IsClosed", typeof(bool), typeof(GroupBox), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnIsClosedChangedPCC)));

public bool IsClosed {
get {
return (bool)this.GetValue(IsClosedProperty);
}
set {
this.SetValue(IsClosedProperty, value);
OnIsClosedChanged();
}
}



private static void OnIsClosedChangedPCC(DependencyObject d, DependencyPropertyChangedEventArgs e) {
GroupBox current = (GroupBox)d;
current.IsClosed = current.IsClosed;
}



private void OnIsClosedChanged() {
_rowDefContent.Height = new GridLength((IsClosed ? 0 : 1), GridUnitType.Star);
}


That does now re-set the IsClosedValue which triggers the OnIsClosedChanged to run.

Thank's for your help guys!







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 3 '15 at 15:16









Noel WidmerNoel Widmer

2,42343246




2,42343246













  • Right. I meant PropertyChangedCallback of course =)

    – Alexander Kozlov
    Feb 3 '15 at 15:17






  • 1





    Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

    – Clemens
    Feb 3 '15 at 15:18





















  • Right. I meant PropertyChangedCallback of course =)

    – Alexander Kozlov
    Feb 3 '15 at 15:17






  • 1





    Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

    – Clemens
    Feb 3 '15 at 15:18



















Right. I meant PropertyChangedCallback of course =)

– Alexander Kozlov
Feb 3 '15 at 15:17





Right. I meant PropertyChangedCallback of course =)

– Alexander Kozlov
Feb 3 '15 at 15:17




1




1





Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

– Clemens
Feb 3 '15 at 15:18







Final step: remove OnIsClosedChanged() from your property setter method. And do not set the property again in the PropertyChangedCallback. That doesn't make sense.

– Clemens
Feb 3 '15 at 15:18




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28301783%2fcallback-when-dependency-property-recieves-xaml-change%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paul Cézanne

UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

Angular material date-picker (MatDatepicker) auto completes the date on focus out