public PopupWindowControl(UserControl userControl, int width = 600, int height = 300) { InitializeComponent(); this.DataContext = popupWindowViewModel = new PopupWindowViewModel(); popupWindowViewModel.PopupContent = userControl; Loaded += PopupWindowControl_Loaded; this.Width = PopupGrid.Width = width; this.Height = PopupGrid.Height = height; }
private void setupViewModel() { if (!windowOpen) { viewModel = container.Resolve <PopupWindowViewModel>(); viewModel.Close = new DelegateCommand(windowClosing); viewModel.PropertyChanged += viewModel_PropertyChanged; windowOpen = true; } }
private void setupViewModel() { if (!windowOpen) { viewModel = container.Resolve<PopupWindowViewModel>(); viewModel.Close = new DelegateCommand(windowClosing); viewModel.PropertyChanged += viewModel_PropertyChanged; windowOpen = true; } }
/// <summary> /// Overriding the parent method for creating a popup /// </summary> protected override void CreatePopup() { //Creating the ViewModel for the PopupWindow (View) var popupViewModel = new PopupWindowViewModel(this) { //Controls setup specific for a Tooltip popup ShowPopupPointer = true, ShowPopupButton = false, ShowTooltipNavigationControls = true, Width = Width, Height = Height }; //The Popup Viewmodel and Host is passed as parameters to the PopupWindow so it will create the popup with the needed values (width, height) stepUIPopup = new PopupWindow(popupViewModel, HostPopupInfo); }
protected override void CreatePopup() { //Creating the ViewModel for the PopupWindow (View) var popupViewModel = new PopupWindowViewModel(this) { //Controls setup specific for a Welcome popup ShowPopupPointer = false, ShowPopupButton = true, ShowTooltipNavigationControls = false, Width = Width, Height = Height }; //The host and the viewmodel is passed as parameters to PopupWindow stepUIPopup = new PopupWindow(popupViewModel, HostPopupInfo); }
public WebBrowserWindow(PopupWindowViewModel viewModel, HostControlInfo hInfo) { InitializeComponent(); webBrowser.Width = viewModel.Width; //The height is subtracted by a const that sums the height of the header and footer of the popup webBrowser.Height = viewModel.Height - headerAndFooterCompensation; //Setting the host over which the popup will appear and the placement mode PlacementTarget = hInfo.HostUIElement; Placement = hInfo.PopupPlacement; //Horizontal offset plus 10 is to compensate the tooltip size HorizontalOffset = hInfo.HorizontalPopupOffSet + tooltipOffset; //Vertical offset plus 50 is to compensate the header size VerticalOffset = hInfo.VerticalPopupOffSet + headerOffset; LoadWebBrowser(hInfo.HtmlPage); }
public PopupWindow(PopupWindowViewModel viewModel, HostControlInfo hInfo) { InitializeComponent(); hostControlInfo = hInfo; if (viewModel != null) { popupViewModel = viewModel; } DataContext = popupViewModel; //Due that we are drawing the Direction pointers on left and right side of the Canvas (10 width each one) then we need to add 20 RootLayout.Width = popupViewModel.Width + (popupBordersOffSet * 2); //Also a shadow of 10 pixels in top and 10 pixels at the bottom will be shown then we need to add 20 RootLayout.Height = popupViewModel.Height + (popupBordersOffSet * 2); //The BackgroundRectangle represent the tooltip background rectangle that is drawn over a Canvas //Needs to be moved 10 pixels over the X axis to show the direction pointers (Height was already increased above) //Needs to be moved 10 pixels over the Y axis to show the shadow at top and bottom. BackgroundRectangle.Rect = new Rect(popupBordersOffSet, popupBordersOffSet, popupViewModel.Width, popupViewModel.Height); //Setting the host over which the popup will appear and the placement mode PlacementTarget = hInfo.HostUIElement; Placement = hInfo.PopupPlacement; //The CustomRichTextBox has a margin of 10 in left and 10 in right, also there is a indentation for drawing the PointerDirection of 10 of each side so that's why we are subtracting 40. ContentRichTextBox.Width = popupViewModel.Width - (popupBordersOffSet * 4); HorizontalOffset = hInfo.HorizontalPopupOffSet; VerticalOffset = hInfo.VerticalPopupOffSet; Opened += PopupWindow_Opened; Closed += PopupWindow_Closed; isClosingTour = false; EnsureStandardPopupAlignment(); }