Articles in this section
Category / Section

How to get triggers the event when a toolbar is dragged to a float state in WinForms CommandBar?

1 min read

Handle ParentChanged event

The CommandBar's ParentChanged event gets trigger. Because when toolbar's state gets changed from dock to float its parent also get changed. Please refer the below code snippet which illustrates this:


CommandBar cbar = this.mainFrameBarManager1.GetCommandBarManager().GetCommandBarFromBar(this.bar1);
cbar.ParentChanged += new EventHandler(cbar_ParentChanged);
void cbar_ParentChanged(object sender, EventArgs e)
   this.textBox1.Text = "Parent Changed";


Dim commandBar As CommandBar = Me.MainFrameBarManager1.GetCommandBarManager().GetCommandBarFromBar(Me.Bar1)
AddHandler commandBar.ParentChanged, AddressOf commandBar_ParentChanged
Private Sub commandBar_ParentChanged(ByVal sender As Object, ByVal e As EventArgs)
   Me.TextBox1.Text = "Parent Changed"
End Sub


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment