We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Docking RibbonBar to the right side in a DLL

Hi,

I'm setting my RibbonTabs from a class library at runtime.

I've tried to use your example from here: https://www.syncfusion.com/kb/5789/how-to-dock-ribbonbar-at-the-right-side

One of the RibbonTabs has RibbonBars in it and as a collapseRibbonBar aswell.

I set
SizeChanged="ribbon_SizeChanged" in the MainWindow where the Ribbon exist.

In there I write the code:

            double width = 0;

            try
            {
                RibbonTabItemsControl ribbontabitem = VisualUtils.FindDescendant( this, typeof( RibbonTabItemsControl ) ) as RibbonTabItemsControl;

                foreach( Button item in VisualUtils.EnumChildrenOfType( ribbontabitem, typeof( Button ) ) )
                {
                    width = item.ActualWidth;
                }

                if( AdvancedDll != null )
                {
                    AdvancedDll.RibbonSizeChanged( ribbontabitem.ActualWidth, width );
                }
            }
            catch( Exception ex )
            {
                WriteToLogFile( "Error: " + ex.ToString() );
            }


And if AdvancedDll exist I enter the
RibbonSizeChanged. 
 
RibbonSizeChanged (In the DLL):


        public void RibbonSizeChanged( double TabActualWidth, double width )
        {
            try
            {
                Measure( new Size() );

                collapseRibbonBar.Width = TabActualWidth - ( ModeBar.ActualWidth + ImportExportBar.ActualWidth + ConfigBar.ActualWidth
                + StandardBar.ActualWidth + ToolsBar.ActualWidth + ViewBar.ActualWidth + MarkersBar.ActualWidth + DownloadBar.ActualWidth )
                - width + 7;
            }
            catch( Exception )
            {

            } 
        }


I don't set Width to the RibbonBars in my class library because I want my application to look the same on different screen resolutions so the
ActualWidth that I received is 0 (that is why I tried to use Measure( new Size() ); but with no success).

In the MainWindow the window state is set to maximized, and it seems that Measure won't work until I resize my window, then I'll get

ActualWidth to all RibbonBars, but still the result looks funny.

I've added a sample video to show you the problem.

Is there a way to fix this issue?

Regards,

Dov.




Attachment: 1_14fa2ae2.rar

3 Replies

KJ Keerthana Jegannathan Syncfusion Team May 18, 2017 12:19 PM UTC

Hi Dov,   
   
Thank you for contacting Syncfusion support.   
   
We have checked the reported behavior by creating a simple sample with your shared code and we were unable to reproduce the reported behavior from our side. We can see the space in the right side of the RibbonBar, we have prepared sample and video for your reference and it can be downloaded from the below location.   
   
Sample: RibbonDemoSample   
   
Video: RibbonCollapse   
   
Can you check with the above video and sample for the scenario we have checked and let us know if we misunderstood your query? If so, then can you share the simple sample which replicates the issue which will be helpful for us to analyze and provide the solution at earliest.   
   
Regards,   
Keerthana J   



DO Dov May 18, 2017 01:27 PM UTC

Hi Keerthana,

Thank you for your fast reply.

You understood the problem, the space on the right side is the problem.

I would like the RibbonBar named: DownloadBar to be docked to the right at all time, without any space, even if I change the window state.

There is a great solution by Syncfusion: Solution (please see sample code in the last comment by M.Sugapriya).

But I can't seem to get it to work properly from a DLL.


Regards,

Dov.





KJ Keerthana Jegannathan Syncfusion Team May 19, 2017 12:05 PM UTC

Hi Dov,   
   
Thanks for explaining your requirement.   
    
We have modified the sample in which we have iterated through the RibbonBar’s of the HomeTab and based on its width we have updated the margin of the RibbonBar which is present at the end of RibbonTab in SizeChanged event of the Ribbon. It can be downloaded from the below location.   
   
Sample: RibbonDemo   
   
Regards,   
Keerthana J  


Loader.
Live Chat Icon For mobile
Up arrow icon