+++ /dev/null
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using Fitness.Views;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Components;
-
-namespace Fitness.Controls
-{
- /// <summary>
- /// Collection View with bindable item source property.
- /// </summary>
- public class BindableCollectionView : CollectionView
- {
- /// <summary>
- /// ItemsSource property.
- /// </summary>
- public static new readonly BindableProperty ItemsSourceProperty =
- BindableProperty.Create(nameof(ItemsSource), typeof(IEnumerable), typeof(BindableCollectionView), null, propertyChanged: OnItemsSourceChanged);
-
- /// <summary>
- /// Initializes a new instance of the <see cref="BindableCollectionView"/> class.
- /// </summary>
- public BindableCollectionView()
- {
- }
-
- /// <summary>
- /// A delegate to be run when ItemsSource property has changed.
- /// </summary>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="oldValue">The old property value.</param>
- /// <param name="newValue">The new property value.</param>
- public static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
- {
- if (bindable is BindableCollectionView collectionView && newValue is IEnumerable itemsSource)
- {
- collectionView.ItemsSource = itemsSource;
- }
- }
- }
-}
xmlns:nui="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
xmlns:styles="clr-namespace:Fitness.Views.Styles"
xmlns:behaviors="clr-namespace:Fitness.Views.Behaviors"
- WidthSpecification="-1"
+ WidthSpecification="MatchParent"
Size="{views:SizeInUnits Height=30}"
x:Name="Root">
<ctrl:NinePatchButton Text="previous"
<ImageView PositionUsesPivotPoint="true" PivotPoint="1.0,0.0" ParentOrigin="1.0, 0.0" Size="30,30" BindingContext="{Binding Source={x:Reference context}, Path=SelectedWorkout}" ResourceUrl="{Binding Favourite, Converter={Static converters:FavouriteToIconConverter.Converter}}"/>
</View>
</View>
- <ctrl:BindableCollectionView Size="{views:SizeInUnits Height=44}" Margin="{views:ExtentsInUnits Top=10, Bottom=10, Start=16, End=16}" WidthSpecification="-1" ItemsSource="{Binding Workouts}" SelectedItem="{Binding Path=SelectedWorkout, Mode=TwoWay}" SelectionMode="SingleAlways" ScrollingDirection="Horizontal">
- <ctrl:BindableCollectionView.ItemTemplate>
+ <nui:CollectionView Size="{views:SizeInUnits Height=44}" Margin="{views:ExtentsInUnits Top=10, Bottom=10, Start=16, End=16}" WidthSpecification="-1" ItemsSource="{Binding Workouts}" SelectedItem="{Binding Path=SelectedWorkout, Mode=TwoWay}" SelectionMode="SingleAlways" ScrollingDirection="Horizontal">
+ <nui:CollectionView.ItemTemplate>
<DataTemplate>
<views:FitnessItemView />
</DataTemplate>
- </ctrl:BindableCollectionView.ItemTemplate>
- <ctrl:BindableCollectionView.ItemsLayouter>
+ </nui:CollectionView.ItemTemplate>
+ <nui:CollectionView.ItemsLayouter>
<nui:GridLayouter />
- </ctrl:BindableCollectionView.ItemsLayouter>
- </ctrl:BindableCollectionView>
+ </nui:CollectionView.ItemsLayouter>
+ </nui:CollectionView>
</ctrl:Page>