2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Binding;
21 using Tizen.NUI.Components.Extension;
23 namespace Tizen.NUI.Components
26 /// RecyclerViewItemStyle is a class which saves RecyclerViewItem's ux data.
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public class RecyclerViewItemStyle : ControlStyle
31 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
32 [EditorBrowsable(EditorBrowsableState.Never)]
33 public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
35 var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
36 RecyclerViewItemStyle.isSelectable = (bool?)newValue;
38 defaultValueCreator: (bindable) =>
40 var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
41 return RecyclerViewItemStyle.isSelectable;
43 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
47 var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
48 RecyclerViewItemStyle.isSelected = (bool?)newValue;
50 defaultValueCreator: (bindable) =>
52 var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
53 return RecyclerViewItemStyle.isSelected;
55 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
59 var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
60 RecyclerViewItemStyle.isEnabled = (bool?)newValue;
62 defaultValueCreator: (bindable) =>
64 var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
65 return RecyclerViewItemStyle.isEnabled;
68 private bool? isSelectable;
69 private bool? isSelected;
70 private bool? isEnabled;
72 static RecyclerViewItemStyle() { }
75 /// Creates a new instance of a RecyclerViewItemStyle.
77 /// <since_tizen> 8 </since_tizen>
78 public RecyclerViewItemStyle() : base()
83 /// Creates a new instance of a RecyclerViewItemStyle with style.
85 /// <param name="style">Create RecyclerViewItemStyle by style customized by user.</param>
86 [EditorBrowsable(EditorBrowsableState.Never)]
87 public RecyclerViewItemStyle(RecyclerViewItemStyle style) : base(style)
92 /// Flag to decide RecyclerViewItem can be selected or not.
94 [EditorBrowsable(EditorBrowsableState.Never)]
95 public bool? IsSelectable
97 get => (bool?)GetValue(IsSelectableProperty);
98 set => SetValue(IsSelectableProperty, value);
102 /// Flag to decide selected state in RecyclerViewItem.
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public bool? IsSelected
107 get => (bool?)GetValue(IsSelectedProperty);
108 set => SetValue(IsSelectedProperty, value);
112 /// Flag to decide RecyclerViewItem can be selected or not.
114 [EditorBrowsable(EditorBrowsableState.Never)]
115 public bool? IsEnabled
117 get => (bool?)GetValue(IsEnabledProperty);
118 set => SetValue(IsEnabledProperty, value);
122 /// Style's clone function.
124 /// <param name="bindableObject">The style that need to copy.</param>
125 [EditorBrowsable(EditorBrowsableState.Never)]
126 public override void CopyFrom(BindableObject bindableObject)
128 base.CopyFrom(bindableObject);
131 if (bindableObject is RecyclerViewItemStyle RecyclerViewItemStyle)