Comments (4)
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!
Open similar issues:
- Combobox changing size when popup open (#4551), similarity score: 0.76
Closed similar issues:
- ComboBox dropdown / flyout opens in the wrong location when using certain RelativePanel attached properties (#6554), similarity score: 0.77
- Opening list in ComboBox causes layout side effects (#6956), similarity score: 0.75
- The WinUI3 popup element can not exceed the parent window area! (#7933), similarity score: 0.73
- Controls (dropdowns) that overhangs the title bar, not clickable (also in WinUI Gallery) (#8788), similarity score: 0.73
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
from microsoft-ui-xaml.
Setting the placeholder text to the current selection works as well - when the popup opens, the width seems to be measured based on the placeholder. Why ComboBox
behaves this way is beyond me, but that's the workaround I'll be using for now.
from microsoft-ui-xaml.
For anyone suffering from this behavior (original credit: Discord user @metrorail
):
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Windows.Foundation;
namespace Files.App.UserControls
{
public class ComboBoxEx : ComboBox
{
double _cachedWidth;
protected override void OnDropDownOpened(object e)
{
Width = _cachedWidth;
base.OnDropDownOpened(e);
}
protected override void OnDropDownClosed(object e)
{
Width = double.NaN;
base.OnDropDownClosed(e);
}
protected override Size MeasureOverride(Size availableSize)
{
var baseSize = base.MeasureOverride(availableSize);
if (baseSize.Width != 64)
_cachedWidth = baseSize.Width;
return baseSize;
}
}
}
from microsoft-ui-xaml.
What is happening here is that when the combobox is opened, the currently selected item is moved into the popup menu so that it can be shown there. But since it was removed from the main part of the ComboBox, that can cause the ComboBox to re-layout at a smaller size and so you get this jarring behavior.
ComboBox should maintain its width when it opens its popup to prevent this issue from happening. The "ComboBoxEx" workaround proposed does that.
Another workaround here would be to set a MinWidth on the ComboBox so that it maintains its size regardless of the selected item.
from microsoft-ui-xaml.
Related Issues (20)
- ComboBox selects the wrong item after it is collapsed HOT 2
- ListView throws ArgumentOutOfRangeException when CollectionChanged is handled with Action = Reset HOT 4
- MediaSource.ExternalTimedTextSources.Clear causes unhandled exception if loaded TimeTextSource was not valid HOT 1
- Pivot Item Content disappears from Pivot when dragging HOT 2
- When the IsSynchronizedWithCurrentItem is true throws XamlParseException HOT 1
- Proposal: Add Method to Hit Test and Manually Transfer Clicks (like in Android & iOS) HOT 4
- Resizing cursor showed near caption button when IsResizable=false while ExtendsContentIntoTitleBar=true HOT 5
- ColorPicker color name tooltip not dismissing HOT 1
- Selected SelectorBarItem text flickers when moving the mouse HOT 2
- MenuFlyout with cascading menus has weird shadow HOT 1
- Hiding titlebar with SetBorderAndTitleBar(true, false) cause maximizing the window hide taskbar HOT 1
- WinUI 3 - Blank App, Packaged (WinUI 3 in Desktop) C# project template crashes in Release configuration HOT 15
- [.NET MAUI 9.0 Preview 4] Windows .NET MAUI App throws a "combase.dll: A fail fast exception occurred" upon making a grid visible on Windows HOT 2
- Using a custom DependencyProperty extension in XAML causes XamlParseException on property assignment HOT 3
- Binding to own dependency properties is not working HOT 5
- TextBox menu does not follow theme change HOT 3
- TextBox menu bad anti-aliasing HOT 1
- WinUI repo “microsoft-ui-xaml-lift” report a large number of errors after building HOT 4
- Annoying automatic focus box without using the keyboard HOT 4
- ListView reorder item triggers ObservableCollection Remove and Add instead of Move HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft-ui-xaml.