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

Fix: Fixed ComboBox position shift #14991

Closed

Conversation

TheChilledBuffalo
Copy link

Resolved / Related Issues

  • Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers.
    Closes Bug: ComboBox list shift to the right when clicked on #14965

Validation
How did you test these changes?

  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?
    1. Open Files Dev build
    2. Click settings button
    3. Go to pages where ComboBox -es are present (General, Appearance, Folders, Layout)
    4. Check the ComboBox -es to see if the changes have been applied

Screenshots (optional)

2024-03-19.12-17-09.mp4

Copy link
Member

@0x5bfa 0x5bfa left a 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" />
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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

Copy link
Member

@0x5bfa 0x5bfa Mar 24, 2024

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?

Copy link
Author

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.

Copy link
Member

@0x5bfa 0x5bfa Mar 24, 2024

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.

Copy link
Member

@0x5bfa 0x5bfa Mar 25, 2024

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.

main...0x5bfa:5bfa/Feature-KeepComboBoxWidth

Copy link
Member

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.

src/Files.App/ResourceDictionaries/ComboBoxStyle.xaml Outdated Show resolved Hide resolved
src/Files.App/ResourceDictionaries/ComboBoxStyle.xaml Outdated Show resolved Hide resolved
@0x5bfa 0x5bfa closed this Mar 26, 2024
@0x5bfa
Copy link
Member

0x5bfa commented Mar 26, 2024

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.

@yaira2
Copy link
Member

yaira2 commented Mar 26, 2024

It's all worth it if it leads to a better solution 🙂

@TheChilledBuffalo TheChilledBuffalo deleted the combo-box-fix branch March 27, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: ComboBox list shift to the right when clicked on
3 participants