Why can't I override metadata more then once?
Hi,
I want to expose this InitialShowDelayProperty setting to the user, I want to apply this value globally. Doing so for the first time seems to work perfectly.
However if I want to override a second time, it will give me this error and seems to not do anything. Why is this? I expect to override the previous metadata. Is this a bug or do I not understand it properly?
I want to expose this InitialShowDelayProperty setting to the user, I want to apply this value globally. Doing so for the first time seems to work perfectly.
Code: Select all
Noesis::ToolTipService::InitialShowDelayProperty->OverrideMetadata(Noesis::TypeOf<Noesis::UIElement>(), Noesis::FrameworkPropertyMetadata::Create(value));Code: Select all
DependencyProperty 'InitialShowDelay' already has metadata for type 'UIElement'-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Why can't I override metadata more then once?
Hi,
OverrideMetadata is done by type, you can only override a dependency property metadata once for each type.
You need to think of this as something static (as in which is the default value for all UIElements, or for all Controls...), and are values you set once at start and can't change during application running.
Investigating ways of making those properties configurable at runtime for all ToolTips in an easy way I found the answer from archimed7592 in this StackOverflow post the most convincing:
https://stackoverflow.com/questions/952 ... y-globally
At application startup you would override the property for FrameworkElement type to make it inheritable:
Then just set the property value in the root element of your UI (or on the part where you want to apply this), preferably using a binding to the ViewModel.
Does that work for you?
OverrideMetadata is done by type, you can only override a dependency property metadata once for each type.
You need to think of this as something static (as in which is the default value for all UIElements, or for all Controls...), and are values you set once at start and can't change during application running.
Investigating ways of making those properties configurable at runtime for all ToolTips in an easy way I found the answer from archimed7592 in this StackOverflow post the most convincing:
https://stackoverflow.com/questions/952 ... y-globally
At application startup you would override the property for FrameworkElement type to make it inheritable:
Code: Select all
Noesis::ToolTipService::InitialShowDelayProperty->OverrideMetadata(Noesis::TypeOf<Noesis::FrameworkElement>(),
Noesis::FrameworkPropertyMetadata::Create(int32_t(400), Noesis::FrameworkPropertyMetadataOptions_Inherits));Does that work for you?
Re: Why can't I override metadata more then once?
Thanks for the reply,
Yes this works indeed. Did come across that post myself but didn't really grasp what it was trying to do.
Thanks
Yes this works indeed. Did come across that post myself but didn't really grasp what it was trying to do.
Thanks
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Why can't I override metadata more then once?
Great! thanks for the update.
Who is online
Users browsing this forum: No registered users and 2 guests