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
TheChilledBuffalo
wants to merge
6
commits into
files-community:main
from
TheChilledBuffalo:combo-box-fix
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f067c94
Fix: Fixed ComboBox position shift
TheChilledBuffalo edc3a83
Remove unnecessary line
TheChilledBuffalo e8db7d8
Change ResourceDictionary name to a better one
TheChilledBuffalo 54f9f9a
Merge branch 'main' into combo-box-fix
TheChilledBuffalo 75454a4
Use default combobox style
TheChilledBuffalo 9a770f7
Merge branch 'main' into combo-box-fix
TheChilledBuffalo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Copyright (c) 2024 Files Community. Licensed under the MIT License. See the LICENSE. --> | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<Style | ||
x:Key="FixedWidthComboBoxStyle" | ||
BasedOn="{StaticResource DefaultComboBoxStyle}" | ||
TargetType="ComboBox"> | ||
<Setter Property="MinWidth" Value="240" /> | ||
</Style> | ||
|
||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
main...0x5bfa:5bfa/Feature-KeepComboBoxWidth
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.