Plugin.SegmentedControl icon indicating copy to clipboard operation
Plugin.SegmentedControl copied to clipboard

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

Open brendonupson opened this issue 5 years ago • 2 comments

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 avatar Apr 20 '20 17:04 brendonupson

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

brendonupson avatar Apr 20 '20 17:04 brendonupson

Workaround appears to be to set the WidthRequest property:

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

brendonupson avatar Apr 20 '20 18:04 brendonupson