I'm trying to add a button to the command bar of a phone app (8.1 and UWP) with a typical Windows Phone share icon. How do I add such an icon to it?
I'd also like it to bring up the sharing window where the user can select the different ways of sharing something. It would share the link to my app in the store, like from the store app.
The command bar can be open or closed. When it's open, it shows primary command buttons with text labels and it opens the overflow menu (if there are secondary commands). The command bar opens the overflow menu upwards (above the primary commands) or downwards (below the primary commands).
Set "Run" to "minimized" and pin it to the taskbar. You probably also want to change the icon (btw you can get the . ico icon of a website by copying it from a Chrome website-shortcut). Then set "Run" to "minimized", add your custom icon and pin it to the taskbar.
With this tie-in, when using Uno Platform to get your UWP/WinUI 3.0 and later apps on Windows 7 you now have two options for running your app: Run your app as a PWA. Your Windows 7 will need Chrome installed on it. Run your app on Chromium through Electron.
1: There is no share charm in Windows 10. What you can do is that you do the icon yourself. This would make it:
<AppBarButton Label="Share" >
<AppBarButton.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph=""/>
</AppBarButton.Icon>
</AppBarButton>
2:
In UWP I would use Share contract. (Basically the DataTransferManager class…)
Here is a good documentation for that: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/mt243293.aspx
Basically:
Hook up the event (e.g. in your page’s constructor..):
DataTransferManager.GetForCurrentView().DataRequested += MainPage_DataRequested;
Show the UWP share UI (e.g. on the button’s event handler..)
DataTransferManager.ShowShareUI();
Do the sharing:
private void MainPage_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
args.Request.Data.SetWebLink(URI);
args.Request.Data.Properties.Title = "My new title";
args.Request.Data.Properties.Description = "description";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With