Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Sizing Issue when adding button tool on ToolVerticalWrapPanel
posted

When excecuting an application thar uses XamRibbon, in some pcs, I got NullReferenceException.

I noticed it happend when the ribbon is loading and executing the resizing.

The error is thrown by ToolVertialWrapPanel:

<igRibbon:XamRibbon x:Name="MainRibbon"
                                IsMinimized="{Binding Path=MinimizarMenu,Mode=TwoWay}"
                                DockPanel.Dock="Top">
                <igRibbon:XamRibbon.ApplicationMenu>
                    <igRibbon:ApplicationMenu Image="/Zeus.CI.Wpf;component/Recursos/Imagenes/Orb.png">
                        <igRibbon:ButtonTool LargeImage="/Zeus.CI.Wpf;component/Recursos/Imagenes/close5.png"
                                             Caption="Salir"
                                             x:Name="btnSalir"
                                             
                                             Command="{Binding Path=CloseCommand}" />
                        <igRibbon:SeparatorTool />
                    </igRibbon:ApplicationMenu>
                <!--Tab: Issued Tab-->
                <igRibbon:RibbonTabItem Header="TAB"
                                        Visibility="{Binding IsThisTabVisible}"
                                        x:Name="tab">
                    <igRibbon:RibbonGroup Caption="General">
                        <igRibbon:ButtonTool                                               Caption="Listar Files"                                              igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge"                                              Opacity="1"                                              LargeImage="..."                                              VerticalAlignment="Stretch"                                              HorizontalAlignment="Left"                                              Command="{Binding Path=SomeCommand}" />
                        ......
                    </igRibbon:RibbonGroup>
                    <igRibbon:RibbonGroup Id="AdvSearchGroup"
                                          Caption="Advance Search">
                            <igRibbon:ToggleButtonTool x:Name="btn1"
                                                   Caption="Files"
                                                   ToolTip="Buscar en Files"
                                                   igRibbon:RibbonGroup.MaximumSize="ImageAndTextNormal"
                                                   Opacity="1"
                                                   LargeImage="..."
                                                   VerticalAlignment="Stretch"
                                                   HorizontalAlignment="Left"
                                                   IsChecked="{Binding Path=Opt1}" />
                            <igRibbon:ToggleButtonTool x:Name="btn2"
                                                   Caption=""
                                                   ToolTip=""
                                                   igRibbon:RibbonGroup.MaximumSize="ImageAndTextNormal"
                                                   Opacity="1"
                                                   LargeImage=""
                                                   VerticalAlignment="Stretch"
                                                   HorizontalAlignment="Left"
                                                   IsChecked="{Binding Path=Opt2}" />
                            <igRibbon:ToggleButtonTool x:Name="btnSomeButtonAction2"
                                                   Caption="Revistas"
                                                   ToolTip="Buscar en Revistas"
                                                   igRibbon:RibbonGroup.MaximumSize="ImageAndTextNormal"
                                                   Opacity="1"
                                                   IsEnabled="{Binding OtherProperty}"
                                                   VerticalAlignment="Stretch"
                                                   HorizontalAlignment="Left"
                                                   IsChecked="{Binding Path=OtherProperty}" />
                            <igRibbon:ToggleButtonTool x:Name="btnSomeButtonAction3"                                                    Caption="Audiovisuales"                                                    Opacity="1"                                                    IsEnabled="{Binding IsEnabledOpt}"                                                    LargeImage="..."                                                    VerticalAlignment="Stretch"                                                    HorizontalAlignment="Left"                                                    IsChecked="{Binding Path=Opt3}" />
                        <igRibbon:ToolVerticalWrapPanel VerticalToolAlignment="Top">
                            ...
                        </igRibbon:ToolVerticalWrapPanel>
                        <igRibbon:ToolVerticalWrapPanel VerticalToolAlignment="Top">
                            <igRibbon:ToolVerticalWrapPanel.Visibility>
                                <MultiBinding Converter="{StaticResource BoolOrToVisibilityConverter}">
                                    <Binding ElementName="btn1" Path="IsChecked" />
                                    <Binding ElementName="btn2" Path="IsChecked"/>
                                </MultiBinding>
                            </igRibbon:ToolVerticalWrapPanel.Visibility>
                            <igRibbon:ToggleButtonTool Caption="AnotherOpt" IsChecked="{Binding Opt, UpdateSourceTrigger=PropertyChanged}"></igRibbon:ToggleButtonTool>
                            <igRibbon:ToggleButtonTool Caption="AnotherOpt" IsChecked="{Binding Opt, UpdateSourceTrigger=PropertyChanged}"></igRibbon:ToggleButtonTool>
                        </igRibbon:ToolVerticalWrapPanel>
                    </igRibbon:RibbonGroup>
                </igRibbon:RibbonTabItem>
                ...
            </igRibbon:XamRibbon>

So when adding another ToggleButtonTool or other button next to the bold text in this xaml, I got this error:

en Infragistics.Windows.Ribbon.ToolVerticalWrapPanel.Infragistics.Windows.Ribbon.IRibbonToolPanel.GetResizableTools(RibbonToolSizingMode destinationSize)
en Infragistics.Windows.Ribbon.GroupActionFactory.CreateToolResizeAction(RibbonToolSizingMode newSizingMode, RibbonToolSizingMode oldSizingMode)
en Infragistics.Windows.Ribbon.GroupActionFactory.CreateAction()
en Infragistics.Windows.Ribbon.VariantManager.ProcessVariantChange(Boolean decrease, Boolean& isNewOperation)
en Infragistics.Windows.Ribbon.RibbonGroupPanel.MeasureOverrideImpl(Size availableSize)
en Infragistics.Windows.Ribbon.RibbonGroupPanel.MeasureOverride(Size availableSize)
en System.Windows.FrameworkElement.MeasureCore(Size availableSize)

How is this issue could be solved?

If I remove some buttons (it's not the idea). there is no problem.

I'm using Infragistics v13.2. Also I notice that this error happend most when the windows taskbar is placed on the left or on the right of the desktop.


Parents
No Data
Reply
  • 6365
    Offline posted

    Hello,

    Thank you for the code-snippet and the image you have provided.

    I have tested the behavior you have described in regards to using ToolVerticalWrapPanel and collapsing it when resizing the XamRibbon and I was not able to reproduce it in either WPF 13.2 or WPF 16.2 product version.

    Since it seems that you have used some additional binding logic and functionality in your application, I was not able to test it in an identical matter. Would you please modify the sample so the issue is reproduced and send it back to me? Having this information will help me further investigate this matter for you.

    Please note that the developer support for WPF 13.2 product has expired as well as it has already had its last Service Release.

    If you have any questions, please let me know.

    XamRibbon_sample.zip
Children
No Data