You can do this by writing converters in height and width.
public class WidthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { return Window.Current.Bounds.Width; } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } public class HeightConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { return Window.Current.Bounds.Height; } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } }
Add this to the resources section of the page -
<common:WidthConverter x:Key="wc" /> <common:HeightConverter x:Key="hc" />
Use them for your popup -
<Popup x:Name="myPopup" > <Grid Background="#FFE5E5E5" Height="{Binding Converter={StaticResource hc}}" Width="{Binding Converter={StaticResource wc}}" /> </Popup>
source share