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

Size value calculated by RibbonGroupBox is not reflected in RibbonControls in Panel control #927

Closed
nishy2000 opened this issue May 4, 2021 · 5 comments · Fixed by #928
Milestone

Comments

@nishy2000
Copy link
Contributor

Size value calculated by RibbonGroupBox is not reflected in RibbonControls in Panel control

I found in the sample code that is used StackPanel as a child control of RibbonGroupBox.
So I think that RibbonGroupBox supports Panel control as a child control.

RibbonGroupBox sets the Size value calculated from State property to Size property of the child controls.
However, I found that the size value was set for the direct child's RibbonControls, but it was not reflected in the RibbonControls in the Panel.

I think that the size value also have to be set for the RibbonControls in Panel control.

How to reproduce this issue:

  1. Add the following code as new RibbonTabItem in TestContent.xaml.
            <Fluent:RibbonTabItem Header="Ribbon controls in panel"
                                  ReduceOrder="PanelGroup12,PanelGroup13,PanelGroup12,PanelGroup13,PanelGroup12,PanelGroup13,PanelGroup12,PanelGroup13"
                                  KeyTip="P">
                <Fluent:RibbonGroupBox x:Name="PanelGroup12"
                                       Header="In StackPanel"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Green.png">
                    <StackPanel Orientation="Horizontal">
                        <Fluent:Button Header="Full(L/L/S) button"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Gray.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/GrayLarge.png"
                                       SizeDefinition="Large,Large,Small"/>
                        <Fluent:Button Header="Full(M/M/S) button"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Yellow.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/YellowLarge.png"
                                       SizeDefinition="Middle,Middle,Small"/>
                        <Fluent:Button Header="Full(L/L/L) button"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Orange.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/OrangeLarge.png"
                                       SizeDefinition="Large"/>
                        <Fluent:Button Header="Full(default) button"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Brown.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/BrownLarge.png" />
                    </StackPanel>
                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox x:Name="PanelGroup13"
                                       Header="In Grid"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Green.png">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Fluent:Button Header="Full(L/L/S) button"
                                       Grid.Column="0"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Gray.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/GrayLarge.png"
                                       SizeDefinition="Large,Large,Small"/>
                        <Fluent:Button Header="Full(M/M/S) button"
                                       Grid.Column="1"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Yellow.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/YellowLarge.png"
                                       SizeDefinition="Middle,Middle,Small"/>
                        <Fluent:Button Header="Full(L/L/L) button"
                                       Grid.Column="2"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Orange.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/OrangeLarge.png"
                                       SizeDefinition="Large"/>
                        <Fluent:Button Header="Full(default) button"
                                       Grid.Column="3"
                                       Icon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Brown.png"
                                       LargeIcon="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/BrownLarge.png" />
                    </Grid>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
  1. Start Fulent.Ribbon.Showcase
  2. Show a added new ribbon tab item
  3. Resize Window
  4. Size of RibbonControl in Panel is not changed

Environment

  • Fluent.Ribbon 9.0.0 preview (latest develop branch (fe50413 [fe50413]))
  • Windows 10 Pro 20H2
  • .NET Framework 4.6.2 / net5.0-windows
@batzen
Copy link
Member

batzen commented May 4, 2021

Changing that behavior is like opening pandoras box.
If we support it in this case, we have to support it everywhere.
I don't see the benefit of adding panels as content of the RibbonGroupBox.

What would be the use case for using a panel inside an itemscontrol?

@nishy2000
Copy link
Contributor Author

One possible use is when we want to use a different layouter than the RibbonGroupBoxWrapPanel layouter only for specific controls. Of course, I understand that we can do something similar with RibbonToolBar.

However, in the process of implementing the simplified ribbon feature, I investigated the Fluent.Ribbon.Showcase sample code. And I found the code using StackPanel in RibbonGroupBox. It is the Test RibbonGroupBox in the Instert RibbonTabItem in TestContent.xaml. So, I thought that it was necessary to support the Panel control in RibbonGroupBox even with the simplified ribbon feature.

But some existing code was not able to support the Panel control in RibbonGroupBox, so I suggested a fix.

If Fluent.Ribbon don't support Panel controls in RibbonGroupBox, I think that it is better not to have StackPanel in the sample code.

Shall I withdraw this proposal?

(I'm not very good at English. I apologize if the explanation is difficult to understand.)

@batzen
Copy link
Member

batzen commented May 5, 2021

No worries about your english. I have no real issues understanding you, even though i am not a native speaker myself. ;-)

The showcase contains code with a custom panel just to make sure it's rendered at all.
Fully supporting custom panels would, most likely, require more work than just the changes you made.
So i don't think it's worth the effort as no one ever asked for such a support.

@nishy2000
Copy link
Contributor Author

I see. How should I handle this issue and PR?

@batzen
Copy link
Member

batzen commented May 5, 2021

Let me think about it a few days.
Maybe i can play around with custom panels during the weekend, determine what else would have to be changed and if it's worth the effort.

batzen added a commit that referenced this issue May 13, 2021
…trols-in-panel

Fix for #927 (RibbonGroupBox size reflection issue)
@batzen batzen added this to the 9.0 milestone May 13, 2021
batzen added a commit that referenced this issue May 15, 2021
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 a pull request may close this issue.

2 participants