Setting ControlState is now allowed only in the derived class of View.
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
base.Dispose(type);
}
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
+ {
+ base.OnControlStateChanged(controlStateChangedInfo);
+
+ var stateEnabled = !((controlStateChangedInfo.CurrentState & ControlStates.Disabled) == ControlStates.Disabled);
+
+ if (isEnabled != stateEnabled)
+ {
+ isEnabled = stateEnabled;
+ }
+
+ var stateSelected = (controlStateChangedInfo.CurrentState & ControlStates.Selected) == ControlStates.Selected;
+
+ if (isSelected != stateSelected)
+ {
+ isSelected = stateSelected;
+ }
+
+ var statePressed = (controlStateChangedInfo.CurrentState & ControlStates.Pressed) == ControlStates.Pressed;
+
+ if (isPressed != statePressed)
+ {
+ isPressed = statePressed;
+ }
+ }
+
/// <summary>
/// It is hijack by using protected, style copy problem when class inherited from Button.
/// </summary>
CreateCheckImage();
if (value)
{
+ ControlState = ControlStates.Selected;
mCheck.Show();
}
else
{
+ ControlState = ControlStates.Normal;
mCheck.Hide();
}
}
if (selectedItemView != null)
{
selectedItemView.IsSelected = false;
- selectedItemView.ControlState = ControlStates.Normal;
adapter.GetData(selectedItemIndex).IsSelected = false;
}
selectedItemIndex = (int)index;
selectedItemView = view;
- selectedItemView.ControlState = ControlStates.Selected;
selectedItemView.IsSelected = true;
adapter.GetData(selectedItemIndex).IsSelected = true;
dropDownMenuFullList.Layout?.RequestLayout();
private bool ListItemTouchEvent(object sender, TouchEventArgs e)
{
PointStateType state = e.Touch.GetState(0);
- DropDownItemView touchedView = sender as DropDownItemView;;
+ DropDownItemView touchedView = sender as DropDownItemView;
+
+ touchedView.OnTouch(e.Touch); // Handle control state change
+
switch (state)
{
case PointStateType.Down:
- if (touchedView != null)
- {
- touchedView.ControlState = ControlStates.Pressed;
- }
itemPressed = true; // if matched with a Up then a click event.
break;
case PointStateType.Motion:
- if (touchedView != null)
- {
- touchedView.ControlState = ControlStates.Normal;
- }
itemPressed = false;
break;
case PointStateType.Up:
LayoutChild();
if (itemList != null && curIndex >= 0 && curIndex < itemList.Count)
{
- itemList[curIndex].ControlState = ControlStates.Selected;
+ itemList[curIndex].IsSelected = true;
UpdateUnderLinePos();
}
else
};
ItemChangedEvent?.Invoke(this, e);
- itemList[curIndex].ControlState = ControlStates.Normal;
+ itemList[curIndex].IsSelected = false;
curIndex = item.Index;
- itemList[curIndex].ControlState = ControlStates.Selected;
+ itemList[curIndex].IsSelected = true;
UpdateUnderLinePos();
}
internal class TabItem : View
{
+ private bool isSelected = false;
+
public TabItem() : base()
{
TextItem = new TextLabel()
get;
set;
}
+
+ internal bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ set
+ {
+ ControlState = value ? ControlStates.Selected : ControlStates.Normal;
+ isSelected = value;
+ }
+ }
}
/// <summary>
isEnabled = value;
if (isEnabled)
{
+ ControlState = ControlStates.Normal;
+
UpdateTrackVisualColor(new Color(0.0f, 0.16f, 0.30f, 1.0f)); // #002A4D
}
else
{
+ ControlState = ControlStates.Disabled;
+
UpdateTrackVisualColor(new Color(0.25f, 0.25f, 0.25f, 1.0f)); // #404040
}
}
return new CircularProgressStyle();
}
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
+ {
+ base.OnControlStateChanged(controlStateChangedInfo);
+
+ var stateEnabled = !((controlStateChangedInfo.CurrentState & ControlStates.Disabled) == ControlStates.Disabled);
+
+ if (isEnabled != stateEnabled)
+ {
+ isEnabled = stateEnabled;
+ }
+ }
+
private void Initialize()
{
{
return controlStates;
}
- set
+ protected set
{
if (controlStates == value)
{