[NUI] Fix Svace issues of dereferenced nullable variables
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RecyclerView / CollectionViewBindableProperty.cs
1 using System.ComponentModel;
2 using System.Windows.Input;
3 using Tizen.NUI.Binding;
4
5 namespace Tizen.NUI.Components
6 {
7     public partial class CollectionView
8     {
9
10         /// <summary>
11         /// ItemsLayouterProperty
12         /// </summary>
13         [EditorBrowsable(EditorBrowsableState.Never)]
14         public static readonly BindableProperty ItemsLayouterProperty = BindableProperty.Create(nameof(ItemsLayouter), typeof(ItemsLayouter), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
15         {
16             var instance = (CollectionView)bindable;
17             if (newValue != null)
18             {
19                 instance.InternalItemsLayouter = newValue as ItemsLayouter;
20             }
21         },
22         defaultValueCreator: (bindable) =>
23         {
24             var instance = (CollectionView)bindable;
25             return instance.InternalItemsLayouter;
26         });
27
28         /// <summary>
29         /// ScrollingDirectionProperty
30         /// </summary>
31         [EditorBrowsable(EditorBrowsableState.Never)]
32         public static readonly new BindableProperty ScrollingDirectionProperty = BindableProperty.Create(nameof(ScrollingDirection), typeof(Tizen.NUI.Components.ScrollableBase.Direction), typeof(CollectionView), default(Direction), propertyChanged: (bindable, oldValue, newValue) =>
33         {
34             var instance = (CollectionView)bindable;
35             if (newValue != null)
36             {
37                 instance.InternalScrollingDirection = (Direction)newValue;
38             }
39         },
40         defaultValueCreator: (bindable) =>
41         {
42             var instance = (CollectionView)bindable;
43             return instance.InternalScrollingDirection;
44         });
45
46         /// <summary>
47         /// SelectionChangedCommandProperty
48         /// </summary>
49         [EditorBrowsable(EditorBrowsableState.Never)]
50         public static readonly BindableProperty SelectionChangedCommandProperty = BindableProperty.Create(nameof(SelectionChangedCommand), typeof(ICommand), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
51         {
52             var instance = (CollectionView)bindable;
53             if (newValue != null)
54             {
55                 instance.InternalSelectionChangedCommand = newValue as ICommand;
56             }
57         },
58         defaultValueCreator: (bindable) =>
59         {
60             var instance = (CollectionView)bindable;
61             return instance.InternalSelectionChangedCommand;
62         });
63
64         /// <summary>
65         /// SelectionChangedCommandParameterProperty
66         /// </summary>
67         [EditorBrowsable(EditorBrowsableState.Never)]
68         public static readonly BindableProperty SelectionChangedCommandParameterProperty = BindableProperty.Create(nameof(SelectionChangedCommandParameter), typeof(object), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
69         {
70             var instance = (CollectionView)bindable;
71             if (newValue != null)
72             {
73                 instance.InternalSelectionChangedCommandParameter = newValue;
74             }
75         },
76         defaultValueCreator: (bindable) =>
77         {
78             var instance = (CollectionView)bindable;
79             return instance.InternalSelectionChangedCommandParameter;
80         });
81
82         /// <summary>
83         /// HeaderProperty
84         /// </summary>
85         [EditorBrowsable(EditorBrowsableState.Never)]
86         public static readonly BindableProperty HeaderProperty = BindableProperty.Create(nameof(Header), typeof(RecyclerViewItem), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
87         {
88             var instance = (CollectionView)bindable;
89             if (newValue != null)
90             {
91                 instance.InternalHeader = newValue as RecyclerViewItem;
92             }
93         },
94         defaultValueCreator: (bindable) =>
95         {
96             var instance = (CollectionView)bindable;
97             return instance.InternalHeader;
98         });
99
100         /// <summary>
101         /// FooterProperty
102         /// </summary>
103         [EditorBrowsable(EditorBrowsableState.Never)]
104         public static readonly BindableProperty FooterProperty = BindableProperty.Create(nameof(Footer), typeof(RecyclerViewItem), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
105         {
106             var instance = (CollectionView)bindable;
107             if (newValue != null)
108             {
109                 instance.InternalFooter = newValue as RecyclerViewItem;
110             }
111         },
112         defaultValueCreator: (bindable) =>
113         {
114             var instance = (CollectionView)bindable;
115             return instance.InternalFooter;
116         });
117
118         /// <summary>
119         /// IsGroupedProperty
120         /// </summary>
121         [EditorBrowsable(EditorBrowsableState.Never)]
122         public static readonly BindableProperty IsGroupedProperty = BindableProperty.Create(nameof(IsGrouped), typeof(bool), typeof(CollectionView), default(bool), propertyChanged: (bindable, oldValue, newValue) =>
123         {
124             var instance = (CollectionView)bindable;
125             if (newValue != null)
126             {
127                 instance.InternalIsGrouped = (bool)newValue;
128             }
129         },
130         defaultValueCreator: (bindable) =>
131         {
132             var instance = (CollectionView)bindable;
133             return instance.InternalIsGrouped;
134         });
135
136         /// <summary>
137         /// GroupHeaderTemplateProperty
138         /// </summary>
139         [EditorBrowsable(EditorBrowsableState.Never)]
140         public static readonly BindableProperty GroupHeaderTemplateProperty = BindableProperty.Create(nameof(GroupHeaderTemplate), typeof(DataTemplate), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
141         {
142             var instance = (CollectionView)bindable;
143             if (newValue != null)
144             {
145                 instance.InternalGroupHeaderTemplate = newValue as DataTemplate;
146             }
147         },
148         defaultValueCreator: (bindable) =>
149         {
150             var instance = (CollectionView)bindable;
151             return instance.InternalGroupHeaderTemplate;
152         });
153
154         /// <summary>
155         /// GroupFooterTemplateProperty
156         /// </summary>
157         [EditorBrowsable(EditorBrowsableState.Never)]
158         public static readonly BindableProperty GroupFooterTemplateProperty = BindableProperty.Create(nameof(GroupFooterTemplate), typeof(DataTemplate), typeof(CollectionView), null, propertyChanged: (bindable, oldValue, newValue) =>
159         {
160             var instance = (CollectionView)bindable;
161             if (newValue != null)
162             {
163                 instance.InternalGroupFooterTemplate = newValue as DataTemplate;
164             }
165         },
166         defaultValueCreator: (bindable) =>
167         {
168             var instance = (CollectionView)bindable;
169             return instance.InternalGroupFooterTemplate;
170         });
171     }
172 }