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
Fix: Fixed ComboBox position shift #14991
Fix: Fixed ComboBox position shift #14991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m really not a fan of this.
|
||
<Style x:Key="ComboBoxStyle" TargetType="ComboBox"> | ||
<Setter Property="CornerRadius" Value="4" /> | ||
<Setter Property="MinWidth" Value="240" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this based on? I don’t like this kind of hard coding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to dynamically set a width depending on the width of the largest ComboBoxItem
but I couldn't. In the end I settled with 240, which seemed reasonable during my testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
240 is a bit large, I would aim for 100.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we make a dynamic extension to measure the largest item size and set that width as min width as other context menus do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not, 100 sounds good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ofc you can work on it if you want because I do have other tasks in Files.
Are you gonna work on it with Yair's approval?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I will leave this to you. I'm still only getting familiar with the codebase and the current solution seems too complex for me atm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think? @yaira2
I've made a branch and added an extension for that though I don't know if it works yet.
I'll need to add a dependency property inside of DependencyObject-derived class(the extension class) and add extensions:ComboBoxExtensions.IsKeepWidthEnabled="True"
.
This will be a similar implementation to alternative row color extensions for ListView comes from WCT 7.x because that extension is also required to be notified of collection change. I assume that the event will be unhooked on unloaded and memory leak won't happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaira2 here’s the implementation. That easy but seems not working when loaded because ActualWidth is 0 then. There must be a way to fix tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks like a neat solution, I think we should move forward with it if that last issue is resolved.
We should’ve discuss this before moving forward but I really appreciate your attitude towards our discussion on this PR. I wish you would continue contributing in any way in Files. Feel free to work on another ready-to-build issues in the project board, in the future. Thank you so much for the first time PR in Files repo! Closing due to a better idea comes up lately. But feel free to comment on a PR I’ll open regarding this issue. |
It's all worth it if it leads to a better solution 🙂 |
Resolved / Related Issues
Closes Bug: ComboBox list shift to the right when clicked on #14965
Validation
How did you test these changes?
ComboBox
-es are present (General, Appearance, Folders, Layout)ComboBox
-es to see if the changes have been appliedScreenshots (optional)
2024-03-19.12-17-09.mp4