This project is read-only.

Popups

StyleMVVM provides an IUIVisualizationService that helps you create popup menus as well as open Views as popup windows.

Popup Menus

Popup menu's are context menu's that allow the user to pick between multiple text strings to make a choice. Below is an example of how to open a popup menu and wait for the users response.
XAML
   <Button View:EventHandlers.Attach="Click => OpenPopup($sender)" />

ViewModel
   [Import]
   public IUIVisualizationService UIService { get; set; }

   public async void OpenPopup(FrameworkElement elemnt)
   {
      var selectedText = await UIService.PopupMenu(element, "Hello","GoodBye");      
   }

Popup Views

Sometimes its nice to be able to open a new View as a popup window oriented around a particular control or point. Below is an example of how to open a popup view oriented below the button.

XAML
   <Button View:EventHandlers.Attach="Click => OpenPopup($sender)" />

ViewModel
   [Import]
   public IUIVisualizationService UIService { get; set; }

   public void OpenPopup(FrameworkElement elemnt)
   {
      UIService.Popup(element, "UserControlView"); 
   }

Last edited Oct 31, 2012 at 3:31 AM by ipjohnson123, version 3

Comments

No comments yet.