SmartEvent<GenGridItemEventArgs> _realized;
SmartEvent<GenGridItemEventArgs> _unrealized;
SmartEvent<GenGridItemEventArgs> _longpressed;
+ SmartEvent<GenGridItemEventArgs> _focused;
+ SmartEvent<GenGridItemEventArgs> _unfocused;
SmartEvent _changed;
/// <summary>
/// <since_tizen> preview </since_tizen>
public event EventHandler<GenGridItemEventArgs> ItemLongPressed;
+ /// <summary>
+ /// ItemFocussed is raised when a gengrid item has received focus.
+ /// </summary>
+ /// <since_tizen> preview </since_tizen>
+ public event EventHandler<GenGridItemEventArgs> ItemFocused;
+
+ /// <summary>
+ /// ItemUnfocussed is raised when a gengrid item has lost focus.
+ /// </summary>
+ /// <since_tizen> preview </since_tizen>
+ public event EventHandler<GenGridItemEventArgs> ItemUnfocused;
+
/// <summary>
/// Changed is raised when an item is added, removed, resized or moved and when the gengrid is resized or gets "horizontal" property changes.
/// </summary>
_realized = new SmartEvent<GenGridItemEventArgs>(this, this.RealHandle, "realized", GenGridItemEventArgs.CreateFromSmartEvent);
_unrealized = new SmartEvent<GenGridItemEventArgs>(this, this.RealHandle, "unrealized", GenGridItemEventArgs.CreateFromSmartEvent);
_longpressed = new SmartEvent<GenGridItemEventArgs>(this, this.RealHandle, "longpressed", GenGridItemEventArgs.CreateFromSmartEvent);
+ _focused = new SmartEvent<GenGridItemEventArgs>(this, this.RealHandle, "item,focused", GenGridItemEventArgs.CreateFromSmartEvent);
+ _unfocused = new SmartEvent<GenGridItemEventArgs>(this, this.RealHandle, "item,unfocused", GenGridItemEventArgs.CreateFromSmartEvent);
_changed = new SmartEvent(this, this.RealHandle, "changed");
_selected.On += (s, e) => { if (e.Item != null) ItemSelected?.Invoke(this, e); };
_realized.On += (s, e) => { if (e.Item != null) ItemRealized?.Invoke(this, e); };
_unrealized.On += (s, e) => { if (e.Item != null) ItemUnrealized?.Invoke(this, e); };
_longpressed.On += (s, e) => { if (e.Item != null) ItemLongPressed?.Invoke(this, e); };
+ _focused.On += (s, e) => { if (e.Item != null) ItemFocused?.Invoke(this, e); };
+ _unfocused.On += (s, e) => { if (e.Item != null) ItemUnfocused?.Invoke(this, e); };
_changed.On += (s, e) => { Changed?.Invoke(this, e); };
}
grid.ItemReleased += Grid_ItemReleased;
grid.ItemLongPressed += Grid_ItemLongPressed;
grid.ItemDoubleClicked += Grid_ItemDoubleClicked;
+ grid.ItemFocused += Grid_ItemFocused;
+ grid.ItemUnfocused += Grid_ItemUnfocused;
+ }
+
+ private void Grid_ItemUnfocused(object sender, GenGridItemEventArgs e)
+ {
+ Color color = (Color)e.Item.Data;
+ Console.WriteLine("#{0:X}{1:X}{2:X} has lost focus", color.R, color.G, color.B);
+ }
+
+ private void Grid_ItemFocused(object sender, GenGridItemEventArgs e)
+ {
+ e.Item.IsSelected = false;
+ Color color = (Color)e.Item.Data;
+ Console.WriteLine("#{0:X}{1:X}{2:X} has received focus", color.R, color.G, color.B);
}
private void Grid_ItemDoubleClicked(object sender, GenGridItemEventArgs e)