Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picker width on Windows not filling container #6391

Closed
mike3sullivan opened this issue Apr 21, 2022 · 14 comments · Fixed by #13516
Closed

Picker width on Windows not filling container #6391

mike3sullivan opened this issue Apr 21, 2022 · 14 comments · Fixed by #13516
Assignees
Labels
area-controls-picker Picker area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@mike3sullivan
Copy link

mike3sullivan commented Apr 21, 2022

Description

When placing a Picker control inside a grid, it does not resize to fill the grid cell on Windows like it does on Android.

Steps to Reproduce

Maui Picker Width.zip
Place a picker control inside a grid -- added backgroundcolors and a margin to show relative sizes.
On Android, it shows the Picker fills the cell; on Windows it shows the Picker as a minimal size inside the larger(blue) cell.

    <Grid ColumnDefinitions="*,*,*" RowDefinitions="*,*,*"  >
        <Grid Grid.Column="1" Grid.Row="1"  BackgroundColor="Blue">
        <Picker SelectedItem="Baboon" BackgroundColor="Green" Margin="3">
            <Picker.Items>
                <x:String>Baboon</x:String>
                <x:String>Capuchin Monkey</x:String>
            </Picker.Items>
        </Picker>
        </Grid>
    </Grid>

picker size android
picker size

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10

Did you find any workaround?

setting width and height manually

Relevant log output

No response

@mike3sullivan mike3sullivan added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Apr 21, 2022
@Redth Redth added this to the 6.0.300 milestone Apr 21, 2022
@hartez hartez added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor labels Apr 21, 2022
@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 22, 2022
@XamlTest
Copy link

Verified this issue with Visual Studio Enterprise 17.3.0 Preview 1.0 [32414.199.main]. Repro on Windows with above project.

@hartez hartez self-assigned this Apr 22, 2022
@davidortinau davidortinau added the p/0 Work that we can't release without label May 1, 2022
@Redth Redth added p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint and removed p/0 Work that we can't release without labels May 3, 2022
@kristinx0211
Copy link

still an issue on windows with 17.3.0 Preview 2.0 [32507.29.main].

@samhouts
Copy link
Member

Still an issue on 6.0.300-rc.4.5760

@samhouts samhouts modified the milestones: 6.0.300, 6.0.300-servicing May 12, 2022
@austinthale
Copy link

On top of that, when a title is set, it appears above the actual picker area instead of inside of it:
image

@samhouts samhouts removed the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jul 20, 2022
@hartez hartez removed their assignment Aug 2, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@notanaverageman
Copy link

To workaround this issue I have mapped the HorizontalOptions of Picker to HorizontalAlignment of ComboBox on Windows.

#if WINDOWS
...
PickerHandler.Mapper.Add(nameof(View.HorizontalOptions), MapHorizontalOptions);
...

private static void MapHorizontalOptions(IViewHandler handler, IView view)
{
	if (view is not View mauiView)
	{
		return;
	}

	if (handler.PlatformView is not Microsoft.UI.Xaml.FrameworkElement element)
	{
		return;
	}

	element.HorizontalAlignment = mauiView.HorizontalOptions.Alignment switch
	{
		LayoutAlignment.Start  => Microsoft.UI.Xaml.HorizontalAlignment.Left,
		LayoutAlignment.Center => Microsoft.UI.Xaml.HorizontalAlignment.Center,
		LayoutAlignment.End    => Microsoft.UI.Xaml.HorizontalAlignment.Right,
		LayoutAlignment.Fill   => Microsoft.UI.Xaml.HorizontalAlignment.Stretch,
		_ => throw new ArgumentOutOfRangeException()
	};
}
#endif

@nk54
Copy link

nk54 commented Nov 15, 2022

I hate this picker look on Windows... If you set a width, nice it's ok. Select an item, the width of the picker is updated to be the size of the selected item. If I set my Picker width to be 200, don't change it to 100 or 120 or 150 depends on the length of the selected item display string value...

@davepruitt
Copy link

Currently experiencing this bug as well.

@Mzazvor
Copy link

Mzazvor commented Jan 26, 2023

Im still having this issue with 17.3.4.

@NPadrutt
Copy link

NPadrutt commented Feb 2, 2023

yeah, I still experience this issue as well.. Given it is in the backlog for more than half a year at this point it seems that doesn't change anytime soon.

@williambohrmann3
Copy link

Also able to repro

@returnNnull
Copy link

Same problem

@melelise89
Copy link

Still experiencing this issue. Thanks for the workaround @notanaverageman!

@nicop85
Copy link

nicop85 commented Mar 13, 2023

+1 to upvote this issue in the priority list

@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Mar 14, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing Mar 17, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Apr 12, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 8 May 24, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-picker Picker area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.