If you want to contribute to the forum discussions, please Register or Login.
Many DigitalRune Gui elements seem to have PropertyChanged event. This event is fired up almost always when I even touch the element with my mouse. My understanding was that his event fires up only when I change the selected index of the item.
Is it possible to get some kind of SelectedIndexChanged event from DropDownButton objects?
The PropertyChanged event is a general event that is raised whenever a game object property is changed. This event is defined in the standard .NET interface INotifyPropertyChanged.
Several properties of UI controls (including the SelectedIndex property) are so-called "game object properties" or "UI control properties". These properties are special and they all have Changed events. Here is an article that describes how you can use the Changed event of a UI control property: http://www.digitalrune.com/Support/Bl... (see section Events).
I tried to subscribe DropDownButton SelectedIndex property:
GameProperty<int> dropDownButtonSlot1SelectedIndexProperty = dropDownButtonSlot1.Properties.Get<int>(dropDownButtonSlot1.SelectedIndex);
However I got a runtime error: Unable to cast object of type 'DigitalRune.Game.GamePropertyMetadata`1[Microsoft.Xna.Framework.Color]' to type 'DigitalRune.Game.GamePropertyMetadata`1[System.Int32]'.
Each game object property has a unique ID. You need to use the ID to get the GameProperty<T> object. The following code should work:
GameProperty<
int
> dropDownButtonSlot1SelectedIndexProperty = dropDownButtonSlot1.Properties.Get<
>(DropDownButton.SelectedIndexPropertyId);
DigitalRune is a trademark of Garstenauer Information Technology OG.
Garstenauer Information Technology OG Weingartenstrasse 35, 4452 Ternberg Austria (EUROPE) office@digitalrune.com