/// <since_tizen> 6 </since_tizen>
public Slider()
{
+ Focusable = true;
Initialize();
}
/// <since_tizen> 8 </since_tizen>
public Slider(string style) : base(style)
{
+ Focusable = true;
Initialize();
}
/// <since_tizen> 8 </since_tizen>
public Slider(SliderStyle sliderStyle) : base(sliderStyle)
{
+ Focusable = true;
Initialize();
}
base.OnFocusLost();
}
+ private bool editMode = false;
+ private View recoverIndicator;
+ private View editModeIndicator;
+
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool OnKeyboardEnter()
+ {
+ if (!IsEnabled)
+ {
+ return false;
+ }
+ if (editMode)
+ {
+ //set editMode false (toggle the mode)
+ editMode = false;
+ FocusManager.Instance.FocusIndicator = recoverIndicator;
+ }
+ else
+ {
+ //set editMode true (toggle the mode)
+ editMode = true;
+ if (editModeIndicator == null)
+ {
+ editModeIndicator = new View()
+ {
+ PositionUsesPivotPoint = true,
+ PivotPoint = new Position(0, 0, 0),
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ BorderlineColor = Color.Red,
+ BorderlineWidth = 6.0f,
+ BorderlineOffset = -1f,
+ BackgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.4f),
+ };
+ }
+ recoverIndicator = FocusManager.Instance.FocusIndicator;
+ FocusManager.Instance.FocusIndicator = editModeIndicator;
+ }
+ return true;
+ }
+
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool OnKey(Key key)
if ((direction == DirectionType.Horizontal && key.KeyPressedName == "Left") ||
(direction == DirectionType.Vertical && key.KeyPressedName == "Down"))
{
- if (MinValue < CurrentValue)
+ if (editMode)
{
- isPressed = true;
- if (IsDiscrete)
- {
- float value = CurrentValue - discreteValue;
- CurrentValue = value < MinValue ? MinValue : value;
- }
- else
+ if (MinValue < CurrentValue)
{
- CurrentValue -= 1;
+ isPressed = true;
+ if (IsDiscrete)
+ {
+ float value = CurrentValue - discreteValue;
+ CurrentValue = value < MinValue ? MinValue : value;
+ }
+ else
+ {
+ CurrentValue -= 1;
+ }
}
return true; // Consumed
}
else if ((direction == DirectionType.Horizontal && key.KeyPressedName == "Right") ||
(direction == DirectionType.Vertical && key.KeyPressedName == "Up"))
{
- if (MaxValue > CurrentValue)
+ if (editMode)
{
- isPressed = true;
- if (IsDiscrete)
+ if (MaxValue > CurrentValue)
{
- float value = CurrentValue + discreteValue;
- CurrentValue = value > MaxValue ? MaxValue : value;
- }
- else
- {
- CurrentValue += 1;
+ isPressed = true;
+ if (IsDiscrete)
+ {
+ float value = CurrentValue + discreteValue;
+ CurrentValue = value > MaxValue ? MaxValue : value;
+ }
+ else
+ {
+ CurrentValue += 1;
+ }
}
return true; // Consumed
}
isPressed = false;
}
+ if (key.KeyPressedName == "Up" || key.KeyPressedName == "Right" || key.KeyPressedName == "Down" || key.KeyPressedName == "Left")
+ {
+ if (editMode)
+ {
+ return true;
+ }
+ }
return false;
}
Utility.Dispose(valueIndicatorText);
this.TouchEvent -= OnTouchEventForTrack;
+
+ recoverIndicator = null;
+ editModeIndicator.Dispose();
+ editModeIndicator = null;
}
base.Dispose(type);
isFocused = isFocusedNew;
isPressed = isPressedNew;
- if(!IsEnabled) // Disabled
+ if (!IsEnabled) // Disabled
{
ControlState = ControlState.Disabled;
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.StyleGuide
+{
+ // IExample inehrited class will be automatically added in the main examples list.
+ internal class AlertDialogExample : ContentPage, IExample
+ {
+ private View rootContent;
+ private Button buttonOneAction, buttonTwoAction, buttonNoTitle, buttonNoMessage;
+
+ public void Activate()
+ {
+ }
+ public void Deactivate()
+ {
+ }
+
+ /// Modify this method for adding other examples.
+ public AlertDialogExample() : base()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent;
+ HeightSpecification = LayoutParamPolicies.MatchParent;
+
+ // Navigator bar title is added here.
+ AppBar = new AppBar()
+ {
+ Title = "AlertDialog Default Style",
+ };
+
+ // Example root content view.
+ // you can decorate, add children on this view.
+ rootContent = new View()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = LayoutParamPolicies.MatchParent,
+
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ CellPadding = new Size2D(10, 20),
+ },
+ };
+
+ buttonOneAction = new Button
+ {
+ Name = "buttonOneAction",
+ Text = "Show AlertDialog with one button",
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ };
+ rootContent.Add(buttonOneAction);
+
+ buttonOneAction.Clicked += (s, e) =>
+ {
+ var button = new Button()
+ {
+ Text = "OK",
+ };
+
+ button.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ DialogPage.ShowAlertDialog("Title", "Message", button);
+ };
+
+ buttonTwoAction = new Button
+ {
+ Name = "buttonTwoAction",
+ Text = "Show AlertDialog with two buttons",
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ };
+ rootContent.Add(buttonTwoAction);
+
+ buttonTwoAction.Clicked += (s, e) =>
+ {
+ var button = new Button()
+ {
+ Text = "Cancel",
+ };
+
+ button.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ var button2 = new Button()
+ {
+ Text = "OK",
+ };
+
+ button2.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ DialogPage.ShowAlertDialog("Title", "Message", button, button2);
+ };
+
+ buttonNoTitle = new Button
+ {
+ Name = "buttonNoTitle",
+ Text = "Show AlertDialog without title",
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ };
+ rootContent.Add(buttonNoTitle);
+
+ buttonNoTitle.Clicked += (s, e) =>
+ {
+ var button = new Button()
+ {
+ Text = "Cancel",
+ };
+
+ button.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ var button2 = new Button()
+ {
+ Text = "OK",
+ };
+
+ button2.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ DialogPage.ShowAlertDialog(null, "Message", button, button2);
+ };
+
+ buttonNoMessage = new Button
+ {
+ Name = "buttonNoMessage",
+ Text = "Show AlertDialog without message",
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ };
+ rootContent.Add(buttonNoMessage);
+
+ buttonNoMessage.Clicked += (s, e) =>
+ {
+ var button = new Button()
+ {
+ Text = "Cancel",
+ };
+
+ button.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ var button2 = new Button()
+ {
+ Text = "OK",
+ };
+
+ button2.Clicked += (object s, ClickedEventArgs a) =>
+ {
+ Navigator?.Pop();
+ };
+
+ DialogPage.ShowAlertDialog("Title", null, button, button2);
+ };
+
+ Content = rootContent;
+ }
+ }
+}
};
// CheckBox examples.
- checkBox = new CheckBox();
+ checkBox = new CheckBox()
+ {
+ WidthSpecification = 100,
+ HeightSpecification = 100,
+ };
rootContent.Add(checkBox);
disabledCheckBox = new CheckBox()
{
+ WidthSpecification = 100,
+ HeightSpecification = 100,
IsEnabled = false,
};
rootContent.Add(disabledCheckBox);
selectedCheckBox = new CheckBox()
{
+ WidthSpecification = 100,
+ HeightSpecification = 100,
IsSelected = true,
};
selectedCheckBox.Clicked += (object obj, ClickedEventArgs ev) =>
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.StyleGuide
+{
+ // IExample inehrited class will be automatically added in the main examples list.
+ internal class PaginationExample : ContentPage, IExample
+ {
+ private View rootContent;
+ private Button buttonLeft, buttonRight;
+ private TextLabel[] board = new TextLabel[2];
+ private Pagination[] pagination = new Pagination[2];
+ private View[] layout = new View[3];
+ private readonly int PAGE_COUNT = 5;
+
+
+
+ public void Activate()
+ {
+ }
+ public void Deactivate()
+ {
+ }
+
+ /// Modify this method for adding other examples.
+ public PaginationExample() : base()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent;
+ HeightSpecification = LayoutParamPolicies.MatchParent;
+
+ // Navigator bar title is added here.
+ AppBar = new AppBar()
+ {
+ Title = "Pagination Default Style",
+ };
+
+ // Example root content view.
+ // you can decorate, add children on this view.
+ rootContent = new View()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = LayoutParamPolicies.MatchParent,
+
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ CellPadding = new Size2D(10, 20),
+ },
+ };
+
+ createBorads();
+
+ buttonLeft = new Button
+ {
+ Name = "buttonLeft",
+ Text = "Left",
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ };
+ rootContent.Add(buttonLeft);
+
+ buttonLeft.Clicked += (s, e) =>
+ {
+ if (pagination[0].SelectedIndex > 0)
+ {
+ pagination[0].SelectedIndex = pagination[0].SelectedIndex - 1;
+ }
+ if (pagination[1].SelectedIndex > 0)
+ {
+ pagination[1].SelectedIndex = pagination[1].SelectedIndex - 1;
+ }
+ };
+
+ buttonRight = new Button
+ {
+ Name = "buttonRight",
+ Text = "Right",
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ };
+ rootContent.Add(buttonRight);
+
+ buttonRight.Clicked += (s, e) =>
+ {
+ if (pagination[0].SelectedIndex < pagination[0].IndicatorCount - 1)
+ {
+ pagination[0].SelectedIndex = pagination[0].SelectedIndex + 1;
+ }
+ if (pagination[1].SelectedIndex < pagination[1].IndicatorCount - 1)
+ {
+ pagination[1].SelectedIndex = pagination[1].SelectedIndex + 1;
+ }
+ };
+
+ Content = rootContent;
+ }
+ void createBorads()
+ {
+ board[0] = new TextLabel();
+ board[0].Size = new Size(300, 50);
+ board[0].PointSize = 15;
+ board[0].HorizontalAlignment = HorizontalAlignment.Center;
+ board[0].VerticalAlignment = VerticalAlignment.Center;
+ board[0].BackgroundColor = Color.Magenta;
+ board[0].Text = "Property construction";
+ rootContent.Add(board[0]);
+
+ // Create by Properties
+ pagination[0] = new Pagination();
+ var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ var indicatorImageUrlStyle = new PaginationStyle()
+ {
+ IndicatorSize = new Size(26, 26),
+ IndicatorSpacing = 8,
+ IndicatorImageUrl = new Selector<string>
+ {
+ Normal = path + "/pagination/pagination_ic_nor.png",
+ Selected = path + "/pagination/pagination_ic_sel.png"
+ }
+ };
+ pagination[0].ApplyStyle(indicatorImageUrlStyle);
+ pagination[0].Name = "Pagination1";
+ pagination[0].Size = new Size(300, 50);
+ pagination[0].BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ pagination[0].IndicatorCount = PAGE_COUNT;
+ pagination[0].SelectedIndex = 0;
+ rootContent.Add(pagination[0]);
+
+ board[1] = new TextLabel();
+ board[1].Size = new Size(300, 50);
+ board[1].PointSize = 15;
+ board[1].HorizontalAlignment = HorizontalAlignment.Center;
+ board[1].VerticalAlignment = VerticalAlignment.Center;
+ board[1].BackgroundColor = Color.Magenta;
+ board[1].Text = "Attribute construction";
+ rootContent.Add(board[1]);
+
+ // Create by Attributes
+ PaginationStyle style = new PaginationStyle()
+ {
+ IndicatorSize = new Size(15, 15),
+ IndicatorSpacing = 20,
+ IndicatorImageUrl = new Selector<string>
+ {
+ Normal = path + "/pagination/pagination_ic_nor.png",
+ Selected = path + "/pagination/pagination_ic_sel.png"
+ }
+ };
+ pagination[1] = new Pagination(style);
+ pagination[1].Name = "Pagination2";
+ pagination[1].Size = new Size(300, 50);
+ pagination[1].BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.6f);
+ pagination[1].IndicatorCount = PAGE_COUNT;
+ pagination[1].SelectedIndex = 0;
+ rootContent.Add(pagination[1]);
+ }
+ }
+}
internal class ProgressExample : ContentPage, IExample
{
private View rootContent;
- private Tizen.NUI.Components.Progress bufferingProgress, disabledProgress, determinatedProgress, indeterminatedProgress;
+ private Progress bufferingProgress, disabledProgress, determinatedProgress, indeterminatedProgress;
public void Activate()
{
// Navigator bar title is added here.
AppBar = new AppBar()
{
- Title = "Slider Default Style",
+ Title = "Progress Default Style",
};
// Example root content view.
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.StyleGuide
+{
+ // IExample inehrited class will be automatically added in the main examples list.
+ internal class RadioButtonExample : ContentPage, IExample
+ {
+ private View rootContent;
+ private View left;
+ private View right;
+ private View leftbody;
+ private View rightbody;
+
+ private TextLabel[] createText = new TextLabel[2];
+ private TextLabel[] modeText = new TextLabel[4];
+ private TextLabel[] modeText2 = new TextLabel[4];
+
+ private RadioButton[] utilityRadioButton = new RadioButton[4];
+ private RadioButton[] familyRadioButton = new RadioButton[4];
+ private RadioButton[] foodRadioButton = new RadioButton[4];
+ private RadioButton[] kitchenRadioButton = new RadioButton[4];
+ private RadioButtonGroup[] group = new RadioButtonGroup[4];
+
+ private RadioButton[] utilityRadioButton2 = new RadioButton[4];
+ private RadioButton[] familyRadioButton2 = new RadioButton[4];
+ private RadioButton[] foodRadioButton2 = new RadioButton[4];
+ private RadioButton[] kitchenRadioButton2 = new RadioButton[4];
+ private RadioButtonGroup[] group2 = new RadioButtonGroup[4];
+
+ private static string[] mode = new string[]
+ {
+ "Style A",
+ "Style B",
+ "Style C",
+ "Style D",
+ };
+
+ public void Activate()
+ {
+ }
+ public void Deactivate()
+ {
+ }
+
+ /// Modify this method for adding other examples.
+ public RadioButtonExample() : base()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent;
+ HeightSpecification = LayoutParamPolicies.MatchParent;
+
+ // Navigator bar title is added here.
+ AppBar = new AppBar()
+ {
+ Title = "RadioButton Default Style",
+ };
+
+ var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+
+ // Example root content view.
+ // you can decorate, add children on this view.
+ rootContent = new View()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = LayoutParamPolicies.MatchParent,
+
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ CellPadding = new Size2D(10, 20),
+ },
+ };
+
+ // RadioButton examples.
+ // Create by Property
+ left = new View()
+ {
+ Weight = 0.5f,
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical
+ }
+ };
+
+ //Create left description text.
+ createText[0] = new TextLabel();
+ createText[0].Text = "Create RadioButton just by properties";
+ createText[0].TextColor = Color.White;
+ createText[0].Size = new Size(800, 100);
+ left.Add(createText[0]);
+
+ leftbody = new View();
+ leftbody.Layout = new GridLayout() { Columns = 4 };
+ int num = 4;
+ for (int i = 0; i < num; i++)
+ {
+ group[i] = new RadioButtonGroup();
+ modeText[i] = new TextLabel();
+ modeText[i].Text = mode[i];
+ modeText[i].Size = new Size(200, 48);
+ modeText[i].HorizontalAlignment = HorizontalAlignment.Center;
+ modeText[i].VerticalAlignment = VerticalAlignment.Center;
+ leftbody.Add(modeText[i]);
+ }
+
+ for (int i = 0; i < num; i++)
+ {
+ int index = i + 1;
+
+ // create utility radio button.
+ utilityRadioButton[i] = new RadioButton();
+ utilityRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Left {index}th Utility RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ var utilityStyle = utilityRadioButton[i].Style;
+ utilityStyle.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ utilityStyle.Icon.BackgroundImage = "";
+ utilityStyle.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/controller_btn_radio_on.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/controller_btn_radio_on.png",
+ };
+ utilityRadioButton[i].ApplyStyle(utilityStyle);
+ utilityRadioButton[i].Size = new Size(48, 48);
+ utilityRadioButton[i].Icon.Size = new Size(48, 48);
+ group[0].Add(utilityRadioButton[i]);
+
+ // create family radio button.
+ familyRadioButton[i] = new RadioButton();
+ familyRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Left {index}th Family RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ var familyStyle = familyRadioButton[i].Style;
+ familyStyle.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ familyStyle.Icon.BackgroundImage = "";
+ familyStyle.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ };
+ familyRadioButton[i].ApplyStyle(familyStyle);
+ familyRadioButton[i].Size = new Size(48, 48);
+ familyRadioButton[i].Icon.Size = new Size(48, 48);
+
+ group[1].Add(familyRadioButton[i]);
+
+ // create food radio button.
+ foodRadioButton[i] = new RadioButton();
+ foodRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Left {index}th Food RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ var foodStyle = foodRadioButton[i].Style;
+ foodStyle.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ foodStyle.Icon.BackgroundImage = "";
+ foodStyle.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ };
+ foodRadioButton[i].ApplyStyle(foodStyle);
+ foodRadioButton[i].Size = new Size(150, 48);
+ foodRadioButton[i].Icon.Size = new Size(48, 48);
+
+ group[2].Add(foodRadioButton[i]);
+
+ // create kitchen radio button.
+ kitchenRadioButton[i] = new RadioButton();
+ kitchenRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Left {index}th Kitchen RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ var kitchenStyle = kitchenRadioButton[i].Style;
+ kitchenStyle.Icon.Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ };
+ kitchenStyle.Icon.BackgroundImage = "";
+ kitchenStyle.Icon.ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ };
+ kitchenRadioButton[i].ApplyStyle(kitchenStyle);
+ kitchenRadioButton[i].Size = new Size(48, 48);
+ kitchenRadioButton[i].Icon.Size = new Size(48, 48);
+
+ group[3].Add(kitchenRadioButton[i]);
+
+ leftbody.Add(utilityRadioButton[i]);
+ leftbody.Add(familyRadioButton[i]);
+ leftbody.Add(foodRadioButton[i]);
+ leftbody.Add(kitchenRadioButton[i]);
+ }
+
+ // Create by Attributes
+ right = new View()
+ {
+ Weight = 0.5f,
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical,
+ }
+ };
+
+ rightbody = new View();
+ rightbody.Layout = new GridLayout() { Columns = 4 };
+ createText[1] = new TextLabel();
+ createText[1].Text = "Create RadioButton just by styles";
+ createText[1].TextColor = Color.White;
+ createText[1].Size = new Size(800, 100);
+ right.Add(createText[1]);
+
+ for (int i = 0; i < num; i++)
+ {
+ group2[i] = new RadioButtonGroup();
+ modeText2[i] = new TextLabel();
+ modeText2[i].Text = mode[i];
+ modeText2[i].Size = new Size(200, 48);
+ modeText2[i].HorizontalAlignment = HorizontalAlignment.Center;
+ modeText2[i].VerticalAlignment = VerticalAlignment.Center;
+ rightbody.Add(modeText2[i]);
+ }
+
+ //Create utility style of radio button.
+ ButtonStyle utilityStyle2 = new ButtonStyle
+ {
+ Icon = new ImageViewStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/controller_btn_radio_on.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/controller_btn_radio_on.png",
+ },
+ },
+ };
+ //Create family style of radio button.
+ ButtonStyle familyStyle2 = new ButtonStyle
+ {
+ Icon = new ImageViewStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png",
+ },
+ },
+ };
+ //Create food style of radio button.
+ ButtonStyle foodStyle2 = new ButtonStyle
+ {
+ Icon = new ImageViewStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png",
+ },
+ },
+ };
+ //Create kitchen style of radio button.
+ ButtonStyle kitchenStyle2 = new ButtonStyle
+ {
+ Icon = new ImageViewStyle
+ {
+ Size = new Size(48, 48),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/radiobutton/controller_btn_radio_off.png",
+ Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ Disabled = path + "/radiobutton/controller_btn_radio_off.png",
+ DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png",
+ },
+ },
+ };
+ for (int i = 0; i < num; i++)
+ {
+ int index = i + 1;
+
+ utilityRadioButton2[i] = new RadioButton(utilityStyle2);
+ utilityRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Right {index}th Utility RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ utilityRadioButton2[i].Size = new Size(48, 48);
+ group2[0].Add(utilityRadioButton2[i]);
+
+ familyRadioButton2[i] = new RadioButton(familyStyle2);
+ familyRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Right {index}th Family RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ familyRadioButton2[i].Size = new Size(48, 48);
+ group2[1].Add(familyRadioButton2[i]);
+
+ foodRadioButton2[i] = new RadioButton(foodStyle2);
+ foodRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Right {index}th Food RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ foodRadioButton2[i].Size = new Size(48, 48);
+ group2[2].Add(foodRadioButton2[i]);
+
+ kitchenRadioButton2[i] = new RadioButton(kitchenStyle2);
+ kitchenRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
+ {
+ global::System.Console.WriteLine($"Right {index}th Kitchen RadioButton's IsSelected is changed to {args.IsSelected}.");
+ };
+ kitchenRadioButton2[i].Size = new Size(48, 48);
+ group2[3].Add(kitchenRadioButton2[i]);
+
+ rightbody.Add(utilityRadioButton2[i]);
+ rightbody.Add(familyRadioButton2[i]);
+ rightbody.Add(foodRadioButton2[i]);
+ rightbody.Add(kitchenRadioButton2[i]);
+ }
+
+ rootContent.Add(left);
+ rootContent.Add(right);
+ left.Add(leftbody);
+ right.Add(rightbody);
+
+ utilityRadioButton[2].IsEnabled = false;
+ familyRadioButton[2].IsEnabled = false;
+ foodRadioButton[2].IsEnabled = false;
+ kitchenRadioButton[2].IsEnabled = false;
+
+ utilityRadioButton2[2].IsEnabled = false;
+ familyRadioButton2[2].IsEnabled = false;
+ foodRadioButton2[2].IsEnabled = false;
+ kitchenRadioButton2[2].IsEnabled = false;
+
+ utilityRadioButton[3].IsEnabled = false;
+ familyRadioButton[3].IsEnabled = false;
+ foodRadioButton[3].IsEnabled = false;
+ kitchenRadioButton[3].IsEnabled = false;
+ utilityRadioButton[3].IsSelected = true;
+ familyRadioButton[3].IsSelected = true;
+ foodRadioButton[3].IsSelected = true;
+ kitchenRadioButton[3].IsSelected = true;
+
+ utilityRadioButton2[3].IsEnabled = false;
+ familyRadioButton2[3].IsEnabled = false;
+ foodRadioButton2[3].IsEnabled = false;
+ kitchenRadioButton2[3].IsEnabled = false;
+ utilityRadioButton2[3].IsSelected = true;
+ familyRadioButton2[3].IsSelected = true;
+ foodRadioButton2[3].IsSelected = true;
+ kitchenRadioButton2[3].IsSelected = true;
+
+ Content = rootContent;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Tizen.NUI.StyleGuide
+{
+ // IExample inehrited class will be automatically added in the main examples list.
+ internal class SwitchExample : ContentPage, IExample
+ {
+ private View rootContent;
+ private Switch[] switchTest = new Switch[4];
+ private string path;
+
+ public void Activate()
+ {
+ }
+ public void Deactivate()
+ {
+ }
+
+ /// Modify this method for adding other examples.
+ public SwitchExample() : base()
+ {
+ Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n");
+
+ WidthSpecification = LayoutParamPolicies.MatchParent;
+ HeightSpecification = LayoutParamPolicies.MatchParent;
+ // Navigator bar title is added here.
+ AppBar = new AppBar()
+ {
+ Title = "Switch Default Style",
+ };
+
+ // Example root content view.
+ // you can decorate, add children on this view.
+ rootContent = new View()
+ {
+ WidthSpecification = LayoutParamPolicies.MatchParent,
+ HeightSpecification = LayoutParamPolicies.MatchParent,
+
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ CellPadding = new Size2D(10, 20),
+ },
+ };
+
+ path = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+
+ CreateSwitchView();
+
+ Content = rootContent;
+ }
+
+ private void CreateSwitchView()
+ {
+ // Create switch styles
+ SwitchStyle styleTest = new SwitchStyle
+ {
+ Size = new Size(100, 100),
+ IsSelectable = true,
+ Track = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/switch/controller_switch_bg_off.png",
+ Selected = path + "/switch/controller_switch_bg_on.png",
+ Disabled = path + "/switch/controller_switch_bg_off_dim.png",
+ DisabledSelected = path + "/switch/controller_switch_bg_on_dim.png",
+ },
+ Size = new Size(200, 100),
+ Border = new Rectangle(30, 30, 30, 30),
+ },
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(100, 100),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = path + "/switch/controller_switch_handler.png",
+ Selected = path + "/switch/controller_switch_handler.png",
+ Disabled = path + "/switch/controller_switch_handler_dim.png",
+ DisabledSelected = path + "/switch/controller_switch_handler_dim.png",
+ },
+ },
+ };
+
+ // Create by Property
+ for (int i = 0; i < 4; i++)
+ {
+ switchTest[i] = new Switch();
+ switchTest[i].ApplyStyle(styleTest);
+ switchTest[i].Size = new Size(200, 100);
+ switchTest[i].Margin = new Extents(10, 10, 10, 10);
+ switchTest[i].Feedback = true;
+ rootContent.Add(switchTest[i]);
+ }
+ switchTest[2].IsEnabled = false;
+ switchTest[3].IsSelected = true;
+ }
+ }
+}