Place popup at top right corner of a window in XAML


I am developing an app for windows store using c#/xaml.


<Popup x:Name="EditQuantityPopup" x:Uid="EditQuantityPopup" AutomationProperties.AutomationId="EditQuantityPopup" IsLightDismissEnabled="True" IsOpen="{Binding IsEditPopupOpened, Mode=TwoWay}"> <Grid x:Name="PopupPanel" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Opacity=".9" Height="100" Width="230"> <Grid x:Name="ContentPopupGrid" Grid.Row="1" Margin="20,0,10,15"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="10"/> <ColumnDefinition Width="Auto" /> <!--<ColumnDefinition />--> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="{Binding Text}" VerticalAlignment="Center" TextTrimming="WordEllipsis" FontSize="15" Foreground="White"></TextBlock> <ProgressRing Grid.Column="2" IsActive="{Binding LoadingData}" Height="75" Width="75"></ProgressRing> </Grid> </Grid> </Popup>

Code placing popout on top of a bottom app bar:

private void EditQuantityPopup_Opened(object sender, object e) { int margin = 10; int appbarHeight = 90; EditQuantityPopup.HorizontalOffset = margin; EditQuantityPopup.VerticalOffset = Window.Current.CoreWindow.Bounds.Bottom - appbarHeight - PopupPanel.Height - margin; }

How to change code that popup should be placed at top right corner of a window?


It depends on the layout type or types housing your PopUp element. Try this

EditQuantityPopup.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right; EditQuantityPopup.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;

Additional to the above depending on your setup you may have to move the PopUp element to a new column in your Grid. eg

Grid.SetColumn(EditQuantityPopup, [your column number]);

If its in a Canvas you could use

var left = Window.Current.Bounds.Width - EditQuantityPopup.ActualWidth; Canvas.SetLeft(EditQuantityPopup, left); Canvas.SetTop(EditQuantityPopup, 0);

Hope that helps


  • ControlTemplate causeing error “The property 'content' is set more than once”
  • Winrt custrom grid control with gridlines
  • Width=“*” in longlistselector giving error “Error HRESULT E_FAIL has been returned from a call to a
  • WPF - Groupbox header alignment
  • UI not being updated INotifyPropertyChanged
  • Grid.IsSharedScopeSize incompatible with * columns in WPF Grid
  • How to get DataTemplate to fill DataGridTemplateColumn
  • using one data template in another data template in WPF
  • How can I bind a string to double in WPF?
  • WPF c# Listbox external scrollbuttons
  • Silverlight DataGrid validation show validation error for all objects|properties
  • Can I use PropertyChanged and LostFocus together?
  • Multibinding Multiselection ListView
  • Caliburn Micro, How to use ContentControl (or display 'sub' ViewModel) using ViewModel Fir
  • chrome video src change not working
  • Hibernate to update table schema
  • blade.php method outputting it's result to the form
  • Floated image with variable width and heading with background image
  • Can't delete or rename original file after resizing
  • Ember.js model to be organised as a tree structure
  • D3 get axis values on zoom event
  • Groovy: Unexpected token “:”
  • Jackson Parser: ignore deserializing for type mismatch
  • Replace value with Factor in r data.table
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • Change multiple background-images with jQuery
  • How to access EntityManager inside Entity class in EJB3
  • Repeat a vertical line on every page in Report Builder / SSRS
  • How to set/get protobuf's extension field in Go?
  • Validaiting emails with Net.Mail MailAddress
  • MySQL WHERE-condition in procedure ignored
  • Trying to switch camera back to front but getting exception
  • How to show dropdown in excel using jrxml (jasper api)?
  • Web-crawler for facebook in python
  • trying to dynamically update Highchart column chart but series undefined
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • python draw pie shapes with colour filled
  • java string with new operator and a literal