Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

ListView separators on only some rows

$
0
0

I have a Master/Detail application where the menu is mostly alphabetized, but Settings and Log Out are at the bottom. I'm using a ListView for the master page's menu. The UI requirement is to put a separator above the non-alphabetical items. So I need a separator above settings and above logout. Like this:

Add
Delete
Edit
Probe
Whatever
(separator)
Settings
(separator)
Log Out

But I don't want a whole row for the separators. Really what I want to do is modify SeparatorColor on the ListView for just a couple items. Is that possible? I'm trying to use a 1px BoxView but then my menu items aren't evenly centered in the ListView and that doesn't look great.

Here's what my viewcell looks like. The background color and label color are so that I can color the frame of the active menu item, because the default selected item color stuff is gross.

edit: apologies, I cannot figure out how to format the XAML block to look good on the forums.

<ViewCell> <ViewCell.View> <StackLayout VerticalOptions="Fill"> <Frame BackgroundColor="{Binding BackgroundColor}" VerticalOptions="Start" BorderColor="{Binding BackgroundColor}" CornerRadius="3" HasShadow="False" HeightRequest="40" Margin="8,4,8,4"> <Frame.Content> <Grid VerticalOptions="Center" HorizontalOptions="Fill" BackgroundColor="{Binding BackgroundColor}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="48"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Image Grid.Column="0" Source="{Binding TileIcon}" Aspect="AspectFit" HeightRequest="24" VerticalOptions="Center" HorizontalOptions="Start" /> <Label Grid.Column="1" Text="{Binding PortalName}" Style="{StaticResource menuItem}" VerticalOptions="Center" TextColor="{Binding LabelColor}" /> </Grid> </Frame.Content> </Frame> </StackLayout> </ViewCell.View> </ViewCell>


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>