Highlighted
Outstanding Contributor.
Outstanding Contributor.
877 views

Prevent window closing

Jump to solution
Hello,
Is there any way to prevent the window from closing use in the upper right CROSS?

There are some situations where I need to control the program output mode and not allow the window to be closed by this way.
Thanks
Alberto Ferraz
0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Prevent window closing

Jump to solution

Hello,

Another issue resolved.

Thanks again.

Alberto Ferraz

View solution in original post

0 Likes
2 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Prevent window closing

Jump to solution

You can do this monitoring the Window_Closing event.

<Window x:Class="WPFApplDataGrid.Window1"

       xmlns="schemas.microsoft.com/.../presentation&quot;

       xmlns:x="schemas.microsoft.com/.../xaml&quot;

       xmlns:gl="clr-namespace:System.Globalization;assembly=mscorlib"

       Title="{Binding Titel}"

       Height="450" Width="650"

       WindowStartupLocation="CenterScreen"

       Closing="Window_Closing">

      method-id PBSchliessen_Click final private.  *> Button for Closing

      procedure division using by value sender as object e as type System.Windows.RoutedEventArgs.

          set PBSchliessenClick to true.

          invoke self::Close().

      end method.

      method-id Window_Closing.

      procedure division using by value sender as object e as type System.ComponentModel.CancelEventArgs.

           if not PBSchliessenClick

              set e::Cancel to true

           end-if.

      end method.

Werner Lanter

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Prevent window closing

Jump to solution

Hello,

Another issue resolved.

Thanks again.

Alberto Ferraz

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.