fluentribbon / Fluent.Ribbon

WPF Ribbon control like in Office
http://fluentribbon.github.io
MIT License
2.55k stars 517 forks source link

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

Closed nishy2000 closed 3 years ago

nishy2000 commented 3 years ago

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

batzen commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

batzen commented 3 years ago

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.