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

How to align controls such as ToggleButton, Spinner with text #494

Closed
TruePluto opened this issue Jan 3, 2018 · 12 comments
Closed

How to align controls such as ToggleButton, Spinner with text #494

TruePluto opened this issue Jan 3, 2018 · 12 comments
Assignees
Milestone

Comments

@TruePluto
Copy link

TruePluto commented Jan 3, 2018

I have some controls such as ToggleButton, Spinner with text and icon, but they don't align well because the texts' length are different.. I know Grid have a property called IsSharedSizeScope, do they have some kind of this property.

@batzen
Copy link
Member

batzen commented Jan 3, 2018

Could you provide a screenshot showing your issue?

@TruePluto
Copy link
Author

captures

It's hard to figure out how to post a image. but now it's ok
Actually I want the textboxes of CATMULLLROOM and POINT to align. and the textblocks of interpolation and sample type are right alignment.
Thanks for your response.

@batzen
Copy link
Member

batzen commented Jan 9, 2018

Now i get it.
Will have a look at how to enable such a feature.

@batzen batzen self-assigned this Jan 9, 2018
@batzen
Copy link
Member

batzen commented Jan 20, 2018

I found a solution for this issue.
The general idea is that you'd have to set Grid.IsSharedSizeScope="True" for each RibbonGroupBox that should size headers of controls like Spinner and ComboBox equally.

@TruePluto If you place Spinner and ComboBox in on top of each other, should their header sizes be equal?

@batzen batzen added this to the 6.0.0 milestone Jan 20, 2018
@TruePluto
Copy link
Author

Sorry ,I can't understand the meaning of "in on top of each other"
Actually ,my code like this:

            <f:RibbonGroupBox Header="Sample"
                              Grid.IsSharedSizeScope="True">
                <f:ComboBox Header="Interpolation Type"
                            ItemsSource="{Binding Source={StaticResource InterpolationType}}"
                            SelectedValue="{x:Static l:Tiff16BitMetaData.DefaultInterpolationType}" />
                <f:ComboBox Header="Sample Type"
                            ItemsSource="{Binding Source={StaticResource SampleType}}"
                            SelectedValue="{Binding Source={x:Static l:TiffDocumentViewModelOptions.Options}, Path=DefaultSampleType}" />
            </f:RibbonGroupBox>

or

            <f:RibbonGroupBox Header="Sample"
                              Grid.IsSharedSizeScope="True">
                <f:ComboBox Header="Interpolation Type"
                            Grid.IsSharedSizeScope="True"
                            ItemsSource="{Binding Source={StaticResource InterpolationType}}"
                            SelectedValue="{x:Static l:Tiff16BitMetaData.DefaultInterpolationType}" />
                <f:ComboBox Header="Sample Type"
                            Grid.IsSharedSizeScope="True"
                            ItemsSource="{Binding Source={StaticResource SampleType}}"
                            SelectedValue="{Binding Source={x:Static l:TiffDocumentViewModelOptions.Options}, Path=DefaultSampleType}" />
            </f:RibbonGroupBox>

I removed the Button AutoUpdate and It didn't work.
Thank you.
cccc

@batzen
Copy link
Member

batzen commented Jan 21, 2018

It currently doesn't work because the code is only on my machine right now.
The first code sample you posted would be the correct one.

Will write some unit tests for the new feature and then push my changes later today so you can try it out.

@TruePluto
Copy link
Author

TruePluto commented Jan 21, 2018

Will It be featured next version ? that's woundful. thank you.

@batzen
Copy link
Member

batzen commented Jan 21, 2018

The feature will be in version 6, which is the next one.

One thing i did not understand is how you would like to align ToggleButton in this context.
Could you explain that a bit more?

@TruePluto
Copy link
Author

I put the toggleButton because it is a bool value and with the two comboBox have a same datacontext, I set the datacontext to the RibbonGroupBox.
I hope it seems like the following picture.
captures

Maybe these icos can move to left.
and thanks for your attention.

@batzen
Copy link
Member

batzen commented Jan 23, 2018

Ok. The general layout for controls in the ribbon is
[Icon] [Header] {[Control]}

The feature i am adding aligns controls that have an additional control to the right. These controls are Spinner and ComboBox.

Something like the control displaying the status in your screenshot is not part of this library.

To get exactly what you want you can, instead of adding the controls separately, just add a Grid to the RibbonGroupBox and layout the controls you add to it excatly in the way you want them. The only things you loose by doing so are things like automatic resizing.

@TruePluto
Copy link
Author

TruePluto commented Jan 24, 2018

I would like to make the ToggleButton out of the column. I just hope the fluent:control with ICON header control such as f:textbox f:combobox f:spiner can be aligned. so I think I can get it at next version. wounderful
thanks.

@batzen batzen closed this as completed in 160f6ee Jan 25, 2018
batzen added a commit to fluentribbon/fluentribbon.github.io that referenced this issue Jan 25, 2018
@batzen
Copy link
Member

batzen commented Jan 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants