c# - How to center a popup in window store app -


I have user controls with custom popups (UserHelperButton). I have set up vertical and horizontal offset manually to show the popup on the right position. Now I need to update the position of the center. I am unable to focus it on X axis and vertical.

I add UserHelperButton to different places on the root windows

   & Lt; Column width = "50" /> & Lt; Column width = "50" /> & Lt; Column width = "120" /> & Lt; Column width = "50" /> & Lt; Column width = "*" /> & Lt; Column width = "120" /> & Lt; Column width = "50" /> & Lt; /Grid.ColumnDefinitions> & Lt; UserControls: UsernameLabel Text = "Vernost We Dwayne" Grid. Column = "0" /> & Lt; UserControls: UserCheckBox x: name = "cbxDouble" grid. Column = "1" cbxClick = "cbxDouble_cbxClick" /> & Lt; UserControls: UserHelperButton Grid.Column = "2" HelperText = "V primeru, zavarujeta dve osebi from da, obe zavarovani osebi pridobita nižjo premijo za sklenjena zavarovanja." / & Gt; & Lt; UserControls: UserLabel x: name = "lblRefNum" text = "refer" grid. Column = "3" /> & Lt; UserControls: UserCheckBox x: Name = "cbxRefNum" grid. Column = "4" cbxClick = "cbxRefNum_cbx" /> & Lt; UserControls: UserTextBox x: Name = "TxbRefNum" Grid. Column = "5" validation message = "Vnesite referencing snippet!" / & Gt; & Lt; UserControls: UserLabel text = "Zaposlen na Pošta Slovenija" grid. Column = "6" /> & Lt; UserControls: UserCheckBox x: Name = "cbxps" grid. Column = "7" cbxClick = "cbxPS_cbx" />  

or

  & lt; Grid margin = "0,25,0,0" & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column width = "500" /> & Lt; Column width = "*" /> & Lt; Column width = "50" /> & Lt; /Grid.ColumnDefinitions> & Lt; UserControls: UserLabel Grid.Column = "0" X: Name = "lblInsurance" text = "Priporočena varnost 65. Leta do" LabelMode = "Title" ValidationMessage = "Vsota zavarovanj je premajhna!" / & Gt; & Lt; UserControls: UserHelperButton x: Name = "Helper 2" grid. Column = "2" /> & Lt; / Grid & gt;  

UserControl XAML:

  & lt; Grid x: name = "grid" margin = "0" maxHeight = "50" canvas.ZIndex = "4" vertical alignment = "center" & gt; & Lt; Button X: name = "btnHelper" AutomationProperties.Name = "" style = "{StaticResource HelpAppBarButtonStyle}" HorizontalAlignment = "left" VerticalAlignment = "center" height = "70" = "btnHelper_Click" /> & Lt; Popup x: name = "pophler" islamic exception animated = "true" verticaloffset = "- 150" horizontal offset = "- 50" & gt; & Lt; Border bordertrains = "25" corner Radius = "25" borderbrush = "gray" background = "gray" & gt; & Lt; Grid Background = "Gray" width = "400" height = "300" & gt; & Lt; Grid.RowDefinitions & gt; & Lt; RowDefinition Height = "60" /> & Lt; Roadfinion height = "*" /> & Lt; /Grid.RowDefinitions> & Lt; Local: UserLabel text = "Pomoč" LabelMode = "title" vertical alignment = "top" /> & Lt; Button X: name = "btnClose" AutomationProperties.Name = "" Grid.Row = "0" style = "{StaticResource NoAppBarButtonStyle}" HorizontalAlignment = "right" verticalAlignment = "top" padding = "12,0,0, 0" Height = "100" = "Btnclose Link" RenderTransformOrigin = "0.5.0.5" & gt; & Lt; Button.RenderTransform & gt; & Lt; Composite Transform Translation Y = "- 15" /> & Lt; /Button.RenderTransform> & Lt; / Button & gt; & Lt; WebView x: Name = "Webview Control" Grid. Line = "1" margin = "0,20,0,0" height = "200" width = "400" /> & Lt; / Grid & gt; & Lt; / Border & gt; & Lt; / Popup & gt;  

I fill the popup with the help text on the load event

  Private Zero userintroduced_loaded (Object Sender, RoutedEventArgs e) {string Html = "& lt; html> & lt; body style = \" font-family: 'saved UI'; Background color: gray; White color; Margin: 0; \ "& Gt;" + G_text + "& lt; / body & gt; & lt; / html & gt;"; Var fragment = HtmlFormatHelper.GetStaticFragment (HtmlFormatHelper.CreateHtmlFormat (html)); (Piece) webviewControl.NavigateToString; }  

So how can I do this?

thx

Poki

I do it like this Are: Private zero popup_Loaded (Object Sender, RoutedEventArgs e) {popup.HorizontalOffset = (Window.Current.bounds.ed - Popup Grid Wideth) / 2; Popup.VerticalOffset = (current.bounce.height - popup grid.height) / 2; }


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -