ProWindow position on the screen

659
2
Jump to solution
04-10-2022 10:59 PM
DavidMrázek
Occasional Contributor II

Hello,
I have a simple question. When you create a ProWindow, is it possible to set its snapshot to load on click? Rather, maybe some position setting on the screen.

Thank you for answer
David

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi, 

How to handle loaded event in WPF here:

https://docs.microsoft.com/en-us/dotnet/desktop/wpf/advanced/how-to-handle-a-loaded-event?view=netfr... 

You can set ProWindow position in xaml or in code. ProWIndow is derived from Window.

In xaml you can use WindowStartupLocation:

 

<controls:ProWindow x:Class="YourWindowView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
        mc:Ignorable="d"
        Title="Window name" MinWidth="550"
        WindowStartupLocation="CenterOwner"
                    d:DataContext="{Binding Path=vm.YourWindowViewModel}"
                    SizeToContent="Height" Width="550"
    >

 

It has few alternatives. More info here:

https://docs.microsoft.com/en-us/dotnet/api/system.windows.window.windowstartuplocation?view=netfram... 

In code you can do like this:

 

    var window = new YourProWindow();
    window.Left = 100;
    window.Top = 100;
    window.ShowDialog();

 

 

 

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi, 

How to handle loaded event in WPF here:

https://docs.microsoft.com/en-us/dotnet/desktop/wpf/advanced/how-to-handle-a-loaded-event?view=netfr... 

You can set ProWindow position in xaml or in code. ProWIndow is derived from Window.

In xaml you can use WindowStartupLocation:

 

<controls:ProWindow x:Class="YourWindowView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
        mc:Ignorable="d"
        Title="Window name" MinWidth="550"
        WindowStartupLocation="CenterOwner"
                    d:DataContext="{Binding Path=vm.YourWindowViewModel}"
                    SizeToContent="Height" Width="550"
    >

 

It has few alternatives. More info here:

https://docs.microsoft.com/en-us/dotnet/api/system.windows.window.windowstartuplocation?view=netfram... 

In code you can do like this:

 

    var window = new YourProWindow();
    window.Left = 100;
    window.Top = 100;
    window.ShowDialog();

 

 

 

DavidMrázek
Occasional Contributor II

Thank you!

0 Kudos