diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-09 20:44:48 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-09 20:48:02 +0100 |
| commit | 673466d57ed603eb5c336ab9c09c7d8a74ec3b02 (patch) | |
| tree | b774fc1bc15c3606ab42fbe948850eb7cbf315e6 /src/GraphicObjects | |
| parent | d783669223da5bfe8caa1b95c0ff6e1c5046e09e (diff) | |
made SeletedItem of templatedGroup writable0.6.0
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/TemplatedGroup.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index c32b2c44..34d57727 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -148,7 +148,18 @@ namespace Crow } } [XmlIgnore]public virtual object SelectedItem{ - get { return data == null ? null : _selectedIndex < 0 ? null : data[_selectedIndex]; } + get { return data == null ? null : _selectedIndex < 0 ? data.GetDefaultValue() : data[_selectedIndex]; } + set { + if (data == null) { + SelectedIndex = -1; + return; + } + //TODO:double check if value type will be notified to binding sys + if (value == SelectedItem) + return; + + SelectedIndex = data.IndexOf (value); + } } [XmlIgnore]public bool HasItems { get { return Items.Count > 0; } |