1iveowl / Plugin.SegmentedControl

MIT License
170 stars 29 forks source link

Dynamically adding new SegmentedControl() does not render correctly in Android #84

Open brendonupson opened 4 years ago

brendonupson commented 4 years ago

When using SegmentedControl on a xaml page, rendering is correct on all platforms (iOS/Android). If I dynamically create a control and add it to a layout:

var seg = new SegmentedControl{ ... }
stackLayout.Children.Add(seg);

It does not render correctly on Android, but iOS is ok.

Screen Shot 2020-04-20 at 21 19 55
brendonupson commented 4 years ago

Seems to be same as https://github.com/alexrainman/SegmentedControl/issues/45#event-1231733344

brendonupson commented 4 years ago

Workaround appears to be to set the WidthRequest property:

var seg = new SegmentedControl
            {
                ...
                WidthRequest = 300,
}
Screen Shot 2020-04-20 at 22 05 39