NNavigationPane event on Collapse and expand


https://www.nevron.com/Forum/Topic5974.aspx
Print Topic | Close Window

By Rudi Groenewald - 13 Years Ago
Hi there,

Is there an event that is being raised when the panel is being collapsed / expanded? I need to write some code on the event. Also, is there a property to know if the panel is collapsed or expanded? I can only see "IsCollapseable", but I don't think this will help for what I need.


My Scenario:

I placed a NNavigationPane Fill Docked into a ShadowDecorator. The Shadowdecorator is docked to the left of the form. When collapsing the panel, the shadowdecorator doesnt "reduce / collapse" with the panel, it stays full width, so now I want to write some code in order to collapse the shadowdecorator, and I also want to save the position of the panel as settings of the user's preference (Generate form with it collapsed)


Any ideas?

By Nevron Support - 13 Years Ago
Hi Rudi,

Currently there is no such event, but you can override OnStateChanged method and put your resizing logic there.

public class MyNNavigationPane : NNavigationPane
   {
      protected override void OnStateChanged()
      {
         base.OnStateChanged();      
         //Resize the Parent control (NShadowDecorator) here.
      }
   }

To obtain whether the navigation pane is collapsed or expanded you should get the value of State property. IsCollapsable property determines whether the control can be collapsed or no.

I hope this helps.
By Rudi Groenewald - 13 Years Ago
ok this probably is gonna sound very silly... I just wanted to see if this will trigger, and it doesnt seem to trigger when I actually click on the collapse button. I tried this in a new class file.


Imports Nevron.UI.WinForm.Controls


Public Class MyNNavigationPane
Inherits NNavigationPane

Protected Overrides Sub OnStateChanged()
MyBase.OnStateChanged()

MsgBox("State Changed ")

End Sub
End Class


any ideas?


By Nevron Support - 13 Years Ago
Hi Rudi,

Have you change the type of the control from NNavigationPane to MyNNavigationPane in the designer generated code?
By Rudi Groenewald - 13 Years Ago
nope, kept it the same...

My navigation pane on the form is called NNavigationPane1


By Nevron Support - 13 Years Ago
Hi Rudi,

You should change the type of the control in the designer generated code to the new type.
Currently, you don't actually use this inherited control.