DataContextChanged event?
Is there no DataContextChanged event? I am currently using a workaround by overriding the metadata for DataContextProperty as follows:
But I'm not sure if there are side effects of doing this?
Also, the forums should allow us to search terms longer than 14 characters... I couldn't do a search for DataContextChanged because it's too long :/
Code: Select all
DataContextProperty.OverrideMetadata(typeof(MyView), new FrameworkPropertyMetadata(null, (o, args) =>
{
/* Do stuff when data context changes */
}));
Also, the forums should allow us to search terms longer than 14 characters... I couldn't do a search for DataContextChanged because it's too long :/
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: DataContextChanged event?
No, but we can add it for the next release.Is there no DataContextChanged event?
Your solution is fine and surely will help others until we expose the event, thanks.I am currently using a workaround by overriding the metadata for DataContextProperty as follows:
But I'm not sure if there are side effects of doing this?Code: Select allDataContextProperty.OverrideMetadata(typeof(MyView), new FrameworkPropertyMetadata(null, (o, args) => { /* Do stuff when data context changes */ }));
Fixed, we extended indexing to 32 character per term. Thanks for pointing out this issue.Also, the forums should allow us to search terms longer than 14 characters... I couldn't do a search for DataContextChanged because it's too long :/
Re: DataContextChanged event?
It didn't work before. I wonder if it was because I was using the empty constructor to call my other constructor using
Leaving just an empty constructor though does seem to do the trick.
Code: Select all
public MyClass() : this(null) {
}
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: DataContextChanged event?
Do you mean that the OverrideMetadata didn't work when your empty constructor called other constructor?
Re: DataContextChanged event?
Sorry, I replied to this thread mistakenly. It was actually meant to be in response to this other thread:
viewtopic.php?f=3&t=747
I had too many tabs open...
viewtopic.php?f=3&t=747
I had too many tabs open...
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: DataContextChanged event?
DataContextChanged event will be available in the next 1.2.4 release
Re: DataContextChanged event?
Fixed in v1.2.4
Who is online
Users browsing this forum: No registered users and 23 guests