Select to view content in your preferred language

How can I make the maximize-button invisible in a ProWindow?

186
4
4 weeks ago
DirkTillmanns
New Contributor III

I set the intended property ShowMaxRestoreButton to false (regardless of whether in XAML or constructor). As you can see in the screenshot, ProWindow seems to manipulate this property during the initialization of the dialog. My WindowsStyle is ToolWindow. Maximize shouldn't be displayed even without being explicitly set. Everything works correctly in System.Windows.Window. ProWindow inherits from this.

Does somebody has any idea?

DirkTillmanns_1-1719222245324.png

 

DirkTillmanns_0-1719221897026.png

 

 

 

 

0 Kudos
4 Replies
DirkTillmanns
New Contributor III

Forgot, I work with ArcGIS Pro 3.3.0

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi,

Adding ResizeMode="NoResize" to ProWindow xaml will hide maximize and minimize buttons and disable windows resizing.

<controls:ProWindow x:Class="************"
        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 Title" 
        ResizeMode="NoResize"
    >
0 Kudos
DirkTillmanns
New Contributor III

Hi,

That's not a solution. I want to allow a resize. But a maximize doesn't make sense in my dialog.

I think there are bugs in the Pro SDK here. Pro manipulates "System.Windows.Window", which it derives from, certainly unintentionally. For example, a "ToolWindow" has no maximize button by default in "Window". But in "ProWindow" it does.

https://learn.microsoft.com/en-us/dotnet/api/system.windows.window.windowstyle?view=windowsdesktop-8... 

 

 

 

0 Kudos
MichaelAustinESGG
New Contributor

I just ran into this problem myself today.  Here's a workaround that worked for me:  As others mentioned, you'll still need to disable resizing in the XAML, but in this version it'll just be temporary.  You'll also need to set the window's Loaded event to execute a method named Window_Loaded.

ResizeMode="NoResize"
ShowMaxRestoreButton="False"
Loaded="Window_Loaded"

Next, go to your code-behind, and implement this method:

private void Window_Loaded(object sender, RoutedEventArgs e) =>
    this.ResizeMode = ResizeMode.CanResize;

 

So the window will get initialized without the Max button being visible, then Window_Loaded will execute, and re-enable resizing later.  The button should not reappear afterward.

0 Kudos