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.