Disable titlebar “X” - close button
This question got repeated a few times already in the past and the answer was that it is not possible yet. I wondered if it is possible by now?
UWP on desktop closed by top X button - no event
the top answer here says it is possible but I had trouble in making it work. I think I need a reference for SystemNavigationManagerPreview
or I need to add
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
in the manifest but I could not figure it on how to do this.
c# uwp titlebar
add a comment |
This question got repeated a few times already in the past and the answer was that it is not possible yet. I wondered if it is possible by now?
UWP on desktop closed by top X button - no event
the top answer here says it is possible but I had trouble in making it work. I think I need a reference for SystemNavigationManagerPreview
or I need to add
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
in the manifest but I could not figure it on how to do this.
c# uwp titlebar
add a comment |
This question got repeated a few times already in the past and the answer was that it is not possible yet. I wondered if it is possible by now?
UWP on desktop closed by top X button - no event
the top answer here says it is possible but I had trouble in making it work. I think I need a reference for SystemNavigationManagerPreview
or I need to add
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
in the manifest but I could not figure it on how to do this.
c# uwp titlebar
This question got repeated a few times already in the past and the answer was that it is not possible yet. I wondered if it is possible by now?
UWP on desktop closed by top X button - no event
the top answer here says it is possible but I had trouble in making it work. I think I need a reference for SystemNavigationManagerPreview
or I need to add
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
in the manifest but I could not figure it on how to do this.
c# uwp titlebar
c# uwp titlebar
asked Nov 12 '18 at 15:23
axbeitaxbeit
1359
1359
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Elsewhere you say you're using VS2015, which can target only up to the Anniversary Update (Build 14393). SystemNavigationManagerPreview.CloseRequested was new for the Creators Update (Build 15603). You'll need to use VS2017 to set your target version high enough to support CloseRequested.
SystemNavigationManagerPreview docs:
Windows 10 requirements
Device family Windows 10 Creators Update (introduced v10.0.15063.0)
Choose a UWP version docs:
Build 15063 (Creators Update, version 1703)
Please note that you must be using Visual Studio 2017 in order to target this version of Windows.
Once you're on Visual Studio 2017 you can set the minimum version in the Project Properties' Application section, and then you'll be able to set the capabilities in your manifest as Stefan and the linked post describe.
For more on defining restricted capabilities see the Restricted Capabilities documentation. In particular, you'll need to define xmlns:rescap and then add it to the IgnorableNamespaces before you can set the capability itself with the code in your question.
<?xml version="1.0" encoding="utf-8"?>
<Package
...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="... rescap">
...
<Capabilities>
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
</Package>
add a comment |
Yes, you are on the right path with this capability. You need to handle the CloseRequested event in order to override what happens when the user clicks the 'X'.
https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.preview.systemnavigationmanagerpreview.closerequested
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265212%2fdisable-titlebar-x-close-button%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Elsewhere you say you're using VS2015, which can target only up to the Anniversary Update (Build 14393). SystemNavigationManagerPreview.CloseRequested was new for the Creators Update (Build 15603). You'll need to use VS2017 to set your target version high enough to support CloseRequested.
SystemNavigationManagerPreview docs:
Windows 10 requirements
Device family Windows 10 Creators Update (introduced v10.0.15063.0)
Choose a UWP version docs:
Build 15063 (Creators Update, version 1703)
Please note that you must be using Visual Studio 2017 in order to target this version of Windows.
Once you're on Visual Studio 2017 you can set the minimum version in the Project Properties' Application section, and then you'll be able to set the capabilities in your manifest as Stefan and the linked post describe.
For more on defining restricted capabilities see the Restricted Capabilities documentation. In particular, you'll need to define xmlns:rescap and then add it to the IgnorableNamespaces before you can set the capability itself with the code in your question.
<?xml version="1.0" encoding="utf-8"?>
<Package
...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="... rescap">
...
<Capabilities>
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
</Package>
add a comment |
Elsewhere you say you're using VS2015, which can target only up to the Anniversary Update (Build 14393). SystemNavigationManagerPreview.CloseRequested was new for the Creators Update (Build 15603). You'll need to use VS2017 to set your target version high enough to support CloseRequested.
SystemNavigationManagerPreview docs:
Windows 10 requirements
Device family Windows 10 Creators Update (introduced v10.0.15063.0)
Choose a UWP version docs:
Build 15063 (Creators Update, version 1703)
Please note that you must be using Visual Studio 2017 in order to target this version of Windows.
Once you're on Visual Studio 2017 you can set the minimum version in the Project Properties' Application section, and then you'll be able to set the capabilities in your manifest as Stefan and the linked post describe.
For more on defining restricted capabilities see the Restricted Capabilities documentation. In particular, you'll need to define xmlns:rescap and then add it to the IgnorableNamespaces before you can set the capability itself with the code in your question.
<?xml version="1.0" encoding="utf-8"?>
<Package
...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="... rescap">
...
<Capabilities>
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
</Package>
add a comment |
Elsewhere you say you're using VS2015, which can target only up to the Anniversary Update (Build 14393). SystemNavigationManagerPreview.CloseRequested was new for the Creators Update (Build 15603). You'll need to use VS2017 to set your target version high enough to support CloseRequested.
SystemNavigationManagerPreview docs:
Windows 10 requirements
Device family Windows 10 Creators Update (introduced v10.0.15063.0)
Choose a UWP version docs:
Build 15063 (Creators Update, version 1703)
Please note that you must be using Visual Studio 2017 in order to target this version of Windows.
Once you're on Visual Studio 2017 you can set the minimum version in the Project Properties' Application section, and then you'll be able to set the capabilities in your manifest as Stefan and the linked post describe.
For more on defining restricted capabilities see the Restricted Capabilities documentation. In particular, you'll need to define xmlns:rescap and then add it to the IgnorableNamespaces before you can set the capability itself with the code in your question.
<?xml version="1.0" encoding="utf-8"?>
<Package
...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="... rescap">
...
<Capabilities>
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
</Package>
Elsewhere you say you're using VS2015, which can target only up to the Anniversary Update (Build 14393). SystemNavigationManagerPreview.CloseRequested was new for the Creators Update (Build 15603). You'll need to use VS2017 to set your target version high enough to support CloseRequested.
SystemNavigationManagerPreview docs:
Windows 10 requirements
Device family Windows 10 Creators Update (introduced v10.0.15063.0)
Choose a UWP version docs:
Build 15063 (Creators Update, version 1703)
Please note that you must be using Visual Studio 2017 in order to target this version of Windows.
Once you're on Visual Studio 2017 you can set the minimum version in the Project Properties' Application section, and then you'll be able to set the capabilities in your manifest as Stefan and the linked post describe.
For more on defining restricted capabilities see the Restricted Capabilities documentation. In particular, you'll need to define xmlns:rescap and then add it to the IgnorableNamespaces before you can set the capability itself with the code in your question.
<?xml version="1.0" encoding="utf-8"?>
<Package
...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="... rescap">
...
<Capabilities>
<rescap:Capability Name="confirmAppClose"/>
</Capabilities>
</Package>
answered Nov 13 '18 at 18:48
Rob Caplan - MSFTRob Caplan - MSFT
19.6k22347
19.6k22347
add a comment |
add a comment |
Yes, you are on the right path with this capability. You need to handle the CloseRequested event in order to override what happens when the user clicks the 'X'.
https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.preview.systemnavigationmanagerpreview.closerequested
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
add a comment |
Yes, you are on the right path with this capability. You need to handle the CloseRequested event in order to override what happens when the user clicks the 'X'.
https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.preview.systemnavigationmanagerpreview.closerequested
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
add a comment |
Yes, you are on the right path with this capability. You need to handle the CloseRequested event in order to override what happens when the user clicks the 'X'.
https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.preview.systemnavigationmanagerpreview.closerequested
Yes, you are on the right path with this capability. You need to handle the CloseRequested event in order to override what happens when the user clicks the 'X'.
https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.preview.systemnavigationmanagerpreview.closerequested
answered Nov 12 '18 at 15:26
Stefan Wick MSFTStefan Wick MSFT
8,91811837
8,91811837
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
add a comment |
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
e.Handled = true;
– lindexi
Nov 13 '18 at 6:12
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
But where would I put the capability? I cant get my mind behind that :X
– axbeit
Nov 13 '18 at 7:56
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
It goes into the package.appxmanifest file in your solution.
– Stefan Wick MSFT
Nov 13 '18 at 14:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265212%2fdisable-titlebar-x-close-button%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown