Failing to understand OverrideMetadata and how to use it
Hey,
I'm trying to change the global default timer for tooltips to stay open. In C# you could do:
And this seems to work fine.
Now I'm trying to do this in C++, but I can't seem to get it to work. I think I don't understand how to use OverrideMetadata properly. I've tried:
But neither attempts give me a 0.1 second timeout (testing), but instead the 5 second default. Am I missing something?
I'm trying to change the global default timer for tooltips to stay open. In C# you could do:
Code: Select all
ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue));Now I'm trying to do this in C++, but I can't seem to get it to work. I think I don't understand how to use OverrideMetadata properly. I've tried:
Code: Select all
//In main window Loaded Event, obviously Noesis::SystemInt32 is not the correct type here, but there is no TypeOf I could use with int32_t.
Noesis::ToolTipService::ShowDurationProperty->OverrideMetadata(Noesis::TypeOf<Noesis::SystemInt32>(), PropertyMetadata::Create(int32_t(100)));
// In main view reflection. This actually gives conflicts when opening tooltips
data->OverrideMetadata<int32_t>(Noesis::ToolTipService::ShowDurationProperty, "ShowDuration", PropertyMetadata::Create(int32_t(100)));
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Failing to understand OverrideMetadata and how to use it
OverrideMetadata specifies a new metadata for the desired type (and derived classes). In that C# code you are saying that all DependencyObject (and derived) instances will have a default value for ShowDuration property of Int32.MaxValue milliseconds.
In theory the code should be the same for Noesis but I noticed that we are ignoring metadata overrides for DependencyObject type, could you please report it in our bugtracker? Anyway you could accomplish almost the same by overriding that property for UIElement type because you probably only want that behavior for UI elements in the visual tree.
In theory the code should be the same for Noesis but I noticed that we are ignoring metadata overrides for DependencyObject type, could you please report it in our bugtracker? Anyway you could accomplish almost the same by overriding that property for UIElement type because you probably only want that behavior for UI elements in the visual tree.
Code: Select all
ToolTipService::ShowDurationProperty->OverrideMetadata(TypeOf<UIElement>(), FrameworkPropertyMetadata::Create(int32_t(INT_MAX)));Who is online
Users browsing this forum: Bing [Bot] and 4 guests