Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<local:CollectionView2
x:Name="collectionView"
FlowDirection="{Binding FlowDirection}"
ItemsSource="{Binding ItemsSource}"
Header="{Binding Header}"
Footer="{Binding Footer}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@
AutomationId="ItemsSourceNone"/>
</HorizontalStackLayout>
</VerticalStackLayout>

<!-- FlowDirection -->
<Label Text="FlowDirection:"
FontSize="12"
FontAttributes="Bold"/>
<StackLayout Orientation="Horizontal">
<RadioButton x:Name="FlowDirectionLeftToRight"
Content="LeftToRight"
GroupName="FlowDirectionOptions"
IsChecked="True"
CheckedChanged="OnFlowDirectionChanged"
FontSize="11"
AutomationId="FlowDirectionLeftToRight"/>
<RadioButton x:Name="FlowDirectionRightToLeft"
Content="RightToLeft"
GroupName="FlowDirectionOptions"
CheckedChanged="OnFlowDirectionChanged"
FontSize="11"
AutomationId="FlowDirectionRightToLeft"/>
</StackLayout>
</StackLayout>
</Grid>
</ScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,16 @@ private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e)
_viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows
}
}

private void OnFlowDirectionChanged(object sender, CheckedChangedEventArgs e)
{
if (FlowDirectionLeftToRight.IsChecked)
{
_viewModel.FlowDirection = FlowDirection.LeftToRight;
}
else if (FlowDirectionRightToLeft.IsChecked)
{
_viewModel.FlowDirection = FlowDirection.RightToLeft;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class CollectionViewViewModel : INotifyPropertyChanged
private object _emptyView;
private object _header;
private object _footer;
private FlowDirection _flowDirection;
private DataTemplate _emptyViewTemplate;
private DataTemplate _headerTemplate;
private DataTemplate _footerTemplate;
Expand Down Expand Up @@ -155,6 +156,12 @@ public object Header
set { _header = value; OnPropertyChanged(); }
}

public FlowDirection FlowDirection
{
get => _flowDirection;
set { _flowDirection = value; OnPropertyChanged(); }
}

public object Footer
{
get => _footer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
Title="CollectionViewFeature">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Options"
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
</ContentPage.ToolbarItems>

<local:CollectionView2
x:Name="collectionView"
ItemsSource="{Binding ItemsSource}"
EmptyView="{Binding EmptyView}"
Header="{Binding Header}"
Footer="{Binding Footer}"
EmptyViewTemplate="{Binding EmptyViewTemplate}"
GroupHeaderTemplate="{Binding GroupHeaderTemplate}"
ItemTemplate="{Binding ItemTemplate}"
IsGrouped="{Binding IsGrouped}"
ItemsLayout="{Binding ItemsLayout}"
AutomationId="CollectionViewControl">
</local:CollectionView2>
<local:CollectionView2
x:Name="collectionView"
FlowDirection="{Binding FlowDirection}"
ItemsSource="{Binding ItemsSource}"
EmptyView="{Binding EmptyView}"
Header="{Binding Header}"
Footer="{Binding Footer}"
EmptyViewTemplate="{Binding EmptyViewTemplate}"
GroupHeaderTemplate="{Binding GroupHeaderTemplate}"
ItemTemplate="{Binding ItemTemplate}"
IsGrouped="{Binding IsGrouped}"
ItemsLayout="{Binding ItemsLayout}"
AutomationId="CollectionViewControl">
</local:CollectionView2>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,26 @@
AutomationId="ItemsSourceEmptyObservableCollection"/>
</HorizontalStackLayout>
</VerticalStackLayout>

<!-- FlowDirection -->
<Label Text="FlowDirection:"
FontSize="12"
FontAttributes="Bold"/>
<StackLayout Orientation="Horizontal">
<RadioButton x:Name="FlowDirectionLeftToRight"
Content="LeftToRight"
GroupName="FlowDirectionOptions"
IsChecked="True"
CheckedChanged="OnFlowDirectionChanged"
FontSize="11"
AutomationId="FlowDirectionLeftToRight"/>
<RadioButton x:Name="FlowDirectionRightToLeft"
Content="RightToLeft"
GroupName="FlowDirectionOptions"
CheckedChanged="OnFlowDirectionChanged"
FontSize="11"
AutomationId="FlowDirectionRightToLeft"/>
</StackLayout>
</StackLayout>
</Grid>
</ScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ private void OnEmptyViewChanged(object sender, CheckedChangedEventArgs e)
grid.Children.Add(new Label
{
Text = "No Items Available(Grid View)",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TextColor = Colors.Blue
});
Expand All @@ -60,7 +59,6 @@ private void OnEmptyViewChanged(object sender, CheckedChangedEventArgs e)
Content = new Label
{
Text = "Custom Empty View (Sized)",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
}
};
Expand Down Expand Up @@ -140,7 +138,6 @@ private void OnEmptyViewTemplateChanged(object sender, CheckedChangedEventArgs e
grid.Children.Add(new Label
{
Text = "No Template Items Available(Grid View)",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
TextColor = Colors.Blue
});
Expand All @@ -163,7 +160,6 @@ private void OnEmptyViewTemplateChanged(object sender, CheckedChangedEventArgs e
Content = new Label
{
Text = "Custom EmptyViewTemplate (Sized)",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
}
};
Expand Down Expand Up @@ -266,5 +262,17 @@ private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e)
_viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows
}
}

private void OnFlowDirectionChanged(object sender, CheckedChangedEventArgs e)
{
if (FlowDirectionLeftToRight.IsChecked)
{
_viewModel.FlowDirection = FlowDirection.LeftToRight;
}
else if (FlowDirectionRightToLeft.IsChecked)
{
_viewModel.FlowDirection = FlowDirection.RightToLeft;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,38 @@
xmlns:local="clr-namespace:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.CollectionViewScrollPage"
Title="CollectionViewScrollPage">
<ContentPage.ToolbarItems>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Options"
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
</ContentPage.ToolbarItems>

<Grid RowDefinitions="Auto, *">
<!-- Fixed Buttons Row -->
<StackLayout Grid.Row="0" Spacing="40" Padding="40">
<Button Text="Add" Command="{Binding AddItemCommand}" IsVisible="{Binding ShowAddRemoveButtons}" WidthRequest="150" AutomationId="AddButton" VerticalOptions="Center" HorizontalOptions="Center" />
<StackLayout Grid.Row="0"
Spacing="40"
Padding="40">
<Button Text="Add"
Command="{Binding AddItemCommand}"
IsVisible="{Binding ShowAddRemoveButtons}"
WidthRequest="150"
AutomationId="AddButton"
VerticalOptions="Center"
HorizontalOptions="Center"/>
</StackLayout>

<!-- Scrollable CollectionView Row -->
<local:CollectionView2 Grid.Row="1"
x:Name="collectionView"
ItemsSource="{Binding ItemsSource}"
ItemSizingStrategy="{Binding ItemSizingStrategy}"
ItemsUpdatingScrollMode="{Binding ItemsUpdatingScrollMode}"
ItemTemplate="{Binding ItemTemplate}"
IsGrouped="{Binding IsGrouped}"
GroupHeaderTemplate="{Binding GroupHeaderTemplate}"
ItemsLayout="{Binding ItemsLayout}"
AutomationId="CollectionViewControl">
</local:CollectionView2>
<local:CollectionView2 Grid.Row="1"
x:Name="collectionView"
FlowDirection="{Binding FlowDirection}"
ItemsSource="{Binding ItemsSource}"
ItemSizingStrategy="{Binding ItemSizingStrategy}"
ItemsUpdatingScrollMode="{Binding ItemsUpdatingScrollMode}"
ItemTemplate="{Binding ItemTemplate}"
IsGrouped="{Binding IsGrouped}"
GroupHeaderTemplate="{Binding GroupHeaderTemplate}"
ItemsLayout="{Binding ItemsLayout}"
AutomationId="CollectionViewControl">
</local:CollectionView2>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
CheckedChanged="OnItemsUpdatingScrollModeChanged"
AutomationId="ItemsUpdatingKeepLastItemInView"/>
</HorizontalStackLayout>
<HorizontalStackLayout Spacing="10">
<HorizontalStackLayout Spacing="10">
<RadioButton x:Name="ItemsUpdatingKeepScrollOffset"
Content="KeepScrollOffset"
FontSize="10"
Expand Down Expand Up @@ -93,7 +93,7 @@
GroupName="ItemsSourceGroup"
CheckedChanged="OnItemsSourceChanged"
AutomationId="ItemsSourceGroupedList2"/>
<RadioButton x:Name="ItemsSourceGroupedList3"
<RadioButton x:Name="ItemsSourceGroupedList3"
Content="Grouped List3"
FontSize="10"
GroupName="ItemsSourceGroup"
Expand Down Expand Up @@ -124,7 +124,7 @@
FontSize="11"
AutomationId="IsGroupedFalse"/>
</StackLayout>
<Label Text="ItemsLayout:"
<Label Text="ItemsLayout:"
FontAttributes="Bold"
FontSize="12"/>
<VerticalStackLayout>
Expand Down Expand Up @@ -160,6 +160,26 @@
AutomationId="ItemsLayoutHorizontalGrid"/>
</HorizontalStackLayout>
</VerticalStackLayout>

<!-- FlowDirection -->
<Label Text="FlowDirection:"
FontSize="12"
FontAttributes="Bold"/>
<StackLayout Orientation="Horizontal">
<RadioButton x:Name="FlowDirectionLeftToRight"
Content="LeftToRight"
GroupName="FlowDirectionOptions"
IsChecked="True"
CheckedChanged="OnFlowDirectionChanged"
FontSize="11"
AutomationId="FlowDirectionLeftToRight"/>
<RadioButton x:Name="FlowDirectionRightToLeft"
Content="RightToLeft"
GroupName="FlowDirectionOptions"
CheckedChanged="OnFlowDirectionChanged"
FontSize="11"
AutomationId="FlowDirectionRightToLeft"/>
</StackLayout>
</StackLayout>
</Grid>
</ScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,16 @@ private void OnItemsLayoutChanged(object sender, CheckedChangedEventArgs e)
_viewModel.ItemsLayout = new GridItemsLayout(2, ItemsLayoutOrientation.Horizontal); // 2 rows
}
}

private void OnFlowDirectionChanged(object sender, CheckedChangedEventArgs e)
{
if (FlowDirectionLeftToRight.IsChecked)
{
_viewModel.FlowDirection = FlowDirection.LeftToRight;
}
else if (FlowDirectionRightToLeft.IsChecked)
{
_viewModel.FlowDirection = FlowDirection.RightToLeft;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
x:Name="collectionView"
Grid.Row="0"
Grid.ColumnSpan="2"
FlowDirection="{Binding FlowDirection}"
Header="{Binding Header}"
Footer="{Binding Footer}"
HeaderTemplate="{Binding HeaderTemplate}"
FooterTemplate="{Binding FooterTemplate}"
ItemsSource="{Binding ItemsSource}"
ItemTemplate="{Binding ItemTemplate}"
ItemsLayout="{Binding ItemsLayout}"
Expand Down
Loading
Loading