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

Check a string for alphabetically ordered characters


This seems so obvious , but I cannot find a way to do this.

CodeIgniter .htaccess remove index.php on Server

php apache .htaccess codeigniter mod-rewrite

I know there's a lot of questions and answers here but I'm really confused and I couldn't fix my problem yet. Please help!