Profile Picture

Programmatically Hide Ribbon

Posted By Ashley Davy 3 Years Ago
Author
Message
Ashley Davy
Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 36, Visits: 119
Is there a way to programmatically hide the ribbon when using the NDrawingViewWithRibbonControl (at some point I just want to see the drawing surface)?  If not how would I transfer the drawing on the current NDrawingViewWithRibbonControl to another NDrawingViewControl?

Thanks,
Ashley

Nevron Support
Posted 3 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,018
Hi,

To hide the ribbon of a drawing view with ribbon control, you can use the following piece of code to first get the ribbon and then set its Visibility to collapsed:
  • C# Code

NRibbon ribbon = drawingViewWithRibbon.GetFirstDescendant<NRibbon>();
ribbon.Visibility = ENVisibility.Collapsed;

  • Visual Basic Code

Dim ribbon As NRibbon = drawingViewWithRibbon.GetFirstDescendant(Of NRibbon)()
ribbon.Visibility = ENVisibility.Collapsed



Best Regards,
Nevron Support Team



Ashley Davy
Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 36, Visits: 119
The code that was suggested shows errors.  The class NDrawingViewWithRibbonControl does not have a direct method call GetFirstDescendant.  I also tried the following code but the ribbon is return as null.

Dim ribbon As NRibbon = Draw1.View.GetFirstDescendant(Of NRibbon)()
   ribbon.Visibility = ENVisibility.Collapsed

Thanks,
Ashley

Ashley Davy
Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 36, Visits: 119
Hello,
I could not get the sample code you gave to compile.  I had to change it to the following.  However when I run this code the ribbon variable is null.  Please advise on what I need to do to hide the ribbon programmatically.  Draw1 is a NDrawingViewWithRibbonControl.

Thanks,
Ashley

Dim ribbon As NRibbon = Draw1.View.GetFirstDescendant(Of NRibbon)()
   ribbon.Visibility = ENVisibility.Collapsed



Nevron Support
Posted 3 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,018
Hi Ashley,

Indeed the code included a shortcut function that is not present in the current release. This must work with 2019.1:

   NRibbon ribbon = nDrawingViewWithRibbonControl1.Widget.GetFirstDescendant<NRibbon>();
    ribbon.Visibility = ENVisibility.Collapsed;

We hope this helps - let us know if you meet any problems.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic