wouldn’t it be better to use the Styles concept to define this type of property ? that way you can even reuse your layout.
For example, in my app I have a listview that I need a specific layout, with the style stayed that way:
<Style x:Key="listGroup" TargetType="ListView">
<Setter Property="BackgroundColor" Value="{DynamicResource Snow}" />
<Setter Property="IsGroupingEnabled" Value="True"/>
</Style>
On listview it looked like this:
<ListView
Style="{DynamicResource listGroup}"
GroupDisplayBinding="{Binding Key}"
GroupShortNameBinding="{Binding Key}"
ItemsSource="{Binding ListaFiltro}" SeparatorVisibility="None"
SelectedItem="{Binding SelectedPedido}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="5">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="40"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Text="{Binding Id}" LineBreakMode="TailTruncation">
</Label>
<Label Grid.Row="1" Grid.Column="0" Text="{Binding Parceiro.CardName}" Font="Small" TextColor="Gray" LineBreakMode="TailTruncation"></Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The important section here is the Style="{Dynamicresource listGroup}" .
This example is in the direct listview, but depending on the control inside your listview you can make a specific style for it.
I already did that friend, only the components that are inside Listview does not let pull by x:Name
– AndreeH
What specifically do you need to change? Have the file xaml to post? Possibly the best solution would be to implement everything via code Cs.
– Junior Porfirio
I need to change the image of a button inside Listview, but it won’t let me access it even with x:Name. Know some other way ?
– AndreeH
Look at this post I answered. http://answall.com/questions/175651/definir-imagem-para-bot%C3%A3o-dentro-de-listview-Xamarin-Forms/175767#175767 There is an option to create Resourcedictionary for the image, but remember that it is necessary to inform the path for each platform in the case of Xamarin.Forms. https://developer.xamarin.com/guides/xamarin-forms/user-interface/styles/application/
– Junior Porfirio