Displaying a Second Form in WPF

I have a main form and as sub form. I need the main Form to display the sub Form and pass into the constructor an object. When the sub Form is done it needs to destroy itself so the cycle can be repeated.

Currently I declared the sub form globaly

Public GlobalWindowBookmark As WindowEditBookmark

I then create the form and pass it the object.

GlobalWindowBookmark = New WindowEditBookmark(CType(_MenuBookmark, BookmarkItem))
GlobalWindowBookmark.Visibility = Windows.Visibility.Visible

This just does not feel right and also allows for multiple windows. Any help would be appreciated.



Do you want the sub form to be a modal dialog - i.e. not allow the user to interact with the main form while it's up? If so, you could do something like this (sorry if my VB is not completely correct, I use C# normally):

Dim wndBookmark as New WindowEditBookmark(CType(_MenuBookmark, BookmarkItem))

There is also a Show method, which displays the window but doesn't make it modal. That might help if you don't want the subform to be modal.

Need Your Help

Pointrange plot with boxplot type grouping

r plot ggplot2 bootstrapping confidence-interval

I have data that could be plotted with a box plot, but n for each box is only 3. I would like to plot them using a pointrange type of plot in ggplot2. By default, they come on top of each other. Ho...