Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

(UWP) First Item Icon is not getting in listview for Master detail page when Custom view cell used

Hi Everyone,

I am using custom view cell for displaying menu item in MasterDetailPage. In this, I am facing the icon problem with very first menu in the listview. Please refer the screenshot and below is my custom view cell for the listview DataTemplate.

/*
Menucell.cs

public class MenuCell : ViewCell
{
public MenuCell()
{
var nameLabel = new Label()
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.Center,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
TextColor = Color.Aqua
};
nameLabel.SetBinding(Label.TextProperty, "Title");

        var image = new Image()
        {
            WidthRequest = 60,
            HeightRequest = 60
        };
        image.SetBinding(Image.SourceProperty, "IconSource");

        var vetDetailsLayout = new StackLayout
        {
            Padding = new Thickness(14, 15, 0, 15),
            Spacing = 18,
            Orientation = StackOrientation.Horizontal,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            Children = { image, nameLabel }
        };
        vetDetailsLayout.SetBinding(StackLayout.BackgroundColorProperty, "TouchColorChange");

        var boxviewLayout = new StackLayout
        {
            Padding = 0,
            Orientation = StackOrientation.Horizontal,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            Children =
            {
                vetDetailsLayout,
            }
        };

        var cellLayout = new StackLayout
        {
            Spacing = 0,
            Orientation = StackOrientation.Horizontal,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            Children = { vetDetailsLayout }
        };
        this.View = cellLayout;
    }
}

*/

Could you please anyone help me here?...

Posts

  • Lakhan124Lakhan124 INMember ✭✭

    It might be emulator problem please rotate the emulator and check for this

  • chandranchandran USMember

    Hi Govind,

    Thanks for the reply.

    I am not running this in emulator. Since its Universal windows application developed in Xamarin forms, I am running this in my local system.

Sign In or Register to comment.