How to style a ListView ImageCell with xaml

StupidRegistrationFormStupidRegistrationForm NLMember
edited April 2017 in Xamarin.Forms

Hi,

I am new so please be gentle.

I am wondering how to style a ListView ImageCell.

I have tried this, but it doesn't seem to work.

in App.Xaml I added this Style

<Style TargetType="ImageCell">
         <Setter Property="TextColor" Value="Blue"></Setter>
</Style>

And I have this xaml in my page:

 <ListView
      ItemsSource="{Binding Items}" x:Name="List" ItemSelected="ListOnItemSelected">
        <ListView.ItemTemplate>
        <DataTemplate>
                    <ImageCell Height="30" 
                                     Text="{Binding Title}"
                                     Detail="{Binding Description}"
                                     ImageSource="{Binding ImageUrl}">
                     </ImageCell>
                </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

The items display as excpected, but, at least in Android, the style is not applied.

Best Answer

Answers

  • Hi,

    I am new so please be gentle.

    I am wondering how to style a ListView ImageCell.

    I have tried this, but it doesn't seem to work.

    in App.Xaml I added this Style

    <Style TargetType="ImageCell">
             <Setter Property="TextColor" Value="Blue"></Setter>
    </Style>
    

    And I have this xaml in my page:

     <ListView
          ItemsSource="{Binding Items}" x:Name="List" ItemSelected="ListOnItemSelected">
            <ListView.ItemTemplate>
            <DataTemplate>
                        <ImageCell Height="30" 
                                         Text="{Binding Title}"
                                         Detail="{Binding Description}"
                                         ImageSource="{Binding ImageUrl}">
                         </ImageCell>
                    </DataTemplate>
          </ListView.ItemTemplate>
        </ListView>
    

    The items display as excpected, but, at least in Android, the style is not applied.

  • @NMackay Ok, thanks, I'll look into that.

  • CavitGonenCavitGonen Member ✭✭

    When we run this slice, the application does not show the data that was running while it was running. It shows only what you can get on the first run. Does not indicate cause of work. ?

  • dwaynemclarendwaynemclaren USMember ✭✭

    @NMackay i change to viewcell still no image

  • NMackayNMackay GBInsider, University mod

    @dwaynemclaren said:
    @NMackay i change to viewcell still no image

    Don't open up an old thread, if you not seeing the image it could be a bad binding, incorrect image resource etc. Open a new thread and post a sample app showing the issue so different people can assist you and copy me in on the thread.

Sign In or Register to comment.