Currently I have a custom ViewCell with a template selector bound to a ObservableCollection. Ive bound the custom cell template to my Xamarin.Forms IOS ListView.
My issue is that i cant disable the highlighting of the Selected Item, the Grey color only appears if i duplicate the selected item via the MenuContext Actions....
Ive tried every Custom Renderer that i found on the Internet :) im nearly giving up seems like that i cant fix this Problem maybe somebody can give me some Information.
Maybe im using a wrong custom renderer. Do i need a renderer for this problem?
ViewCellRenderer
[assembly: ExportRenderer(typeof(GerätViewCell), typeof(NativeViewCellRenderer))]
namespace LindeXF.iOS.Renderer {
public class NativeViewCellRenderer : ViewCellRenderer {
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv) {
var cell = base.GetCell(item, reusableCell, tv);
if (cell != null)
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
return cell;
}
}
}
Custom ViewCell
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LindeXF.Core.CustomTemplates.GerätViewCell"
>
<ViewCell.ContextActions>
<MenuItem x:Name="MenuItemDuplizieren"
CommandParameter="{Binding Id}"
Clicked="OnDuplizierenClicked"
Text="Duplizieren" />
<MenuItem x:Name="MenuItemLöschen"
CommandParameter="{Binding Id}"
Clicked="OnLöschenClicked"
Text="Löschen"
IsDestructive="True" />
</ViewCell.ContextActions>
<Grid ColumnSpacing="0" BackgroundColor="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="9*"/>
<ColumnDefinition Width="7*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="18*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="{Binding BoxColor}" Grid.Column="0"/>
<Label FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="1"/>
<Label FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="2"/>
<Label FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="3"/>
<Label FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="4"/>
<Label FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="5"/>
<Label FontSize="14" HorizontalTextAlignment="End" Margin="0,0,5,0" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="6"/>
<Label FontSize="14" HorizontalTextAlignment="End" Margin="0,0,5,0" VerticalTextAlignment="Center" Text="{Binding Test}" Grid.Column="7"/>
</Grid>
</ViewCell>
ListView
<ListView x:Name="ListViewKalkulation"
Margin="1,0,1,1"
ItemTapped="ListViewKalkulationText_OnItemTapped"
ItemTemplate="{StaticResource TemplateSelector}"
ChildAdded="ListViewKalkulation_OnChildAdded"
ItemSelected="ListViewKalkulation_OnItemSelected"
SeparatorVisibility="None"
BackgroundColor="Silver"
Grid.Row="1" />
Thanks for your Time!