Skip to content

Weird LayoutParameters issue #12

@topsites

Description

@topsites

Using MvvmCross, I have a view with many bindings; one of those happen to be a UILabel

new StackPanel(Orientation.Horizontal)
{
    Spacing = 10,
    SubViews = new View[]
    {
        DialPrefix = new Label("DialPrefix", MainStyleType.Header2, AutoSize.WrapContent)
        {
            TextColor = UIColor.LightGray
        },
        PhoneNumber = new Label("PhoneNumber", MainStyleType.Header2)
        {
            // hack: without specifying the height here, this label doesn't get shown with numeric only
            LayoutParameters = new LayoutParameters(AutoSize.FillParent, 20)
        },
    }
},

Weirdness: PhoneNumber is binded with a VM property (which is a string);

Now with PhoneNumber LayoutParameters as AutoSize.WrapContent, if I set the property value to something like "1234", it will not be visible; using SpyTouch, I can see that the label frame has almost no height.

If I set property value to "A123", it will then show up, or "-123"; however " 123" (space before the value) isn't visible.

Setting LayoutParameter Height to a set value solves my problem for now, but it's not neat.

I have a deadline right now, else I would have uploaded a project. I will try to do that soon.

PS: Thanks for this amazing library; some forum says it can only be used with simple layout - well it works great with all my pages, and some are not so simple :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions