uwp

Get protocol activation args in “Project Centennial” app

浪尽此生 提交于 2019-12-10 12:16:15
问题 How can I access the protocol activation arguments in a Winforms app that's converted into a UWP app? The problem is that the OnActivated method is absent so I can't get the IActivatedEventArgs . 回答1: I'm assuming you want to handle file types in which case you can check Environment.GetCommandLineArgs() as normal for arguments. The second argument will be the file or protocol activated. 回答2: How can I access the protocol activation arguments in a Winforms app that's converted into a UWP app?

How Can My Win32 App Steal Focus From My UWP App?

徘徊边缘 提交于 2019-12-10 11:58:28
问题 I've tried the following code: [DllImport("user32.dll")] private static extern int ShowWindow(IntPtr hwnd, int nCmdShow); [DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll")] private static extern IntPtr SetFocus(IntPtr hwnd); void TakeFocus() { var process = Process.GetProcessesByName("myProcess").FirstOrDefault(); if (process != null) { // Tried each of the following: ShowWindow(process.MainWindowHandle, 1); ShowWindow(process

Binding Background Color of style from a class

可紊 提交于 2019-12-10 11:58:18
问题 in my app i have ColorToBrushConverter.cs, ColorItem.cs and a box page which contain some collection of colors when user click on any of color and back to mainpage it save to settings isolated storage then i able to set my stackpanel any any element background to choosed color from that colorbox page. But Problem is i have a style in which i want color binding so can we do it from c# or use color binding in xaml from below class. ColorToBrushConverter.cs namespace CustomColorsPicker

Proper way to upgrade WPF program settings on program update (Desktop Bridge/Project Centennial)

时光总嘲笑我的痴心妄想 提交于 2019-12-10 11:56:18
问题 When it was a clickonce program it worked, but then I made an appxpackage and exported it as a centennial app for windows store and the upgrade does not work any more. Right now I have in App.xaml.cs protected override void OnStartup(StartupEventArgs e) { if (myprog.Properties.Settings.Default.UpgradeRequired) { myprog.Properties.Settings.Default.Upgrade(); myprog.Properties.Settings.Default.UpgradeRequired = false; myprog.Properties.Settings.Default.Save(); } With UpgradeRequired as a bool

Gridview Item dynamic width according to Screen Size in UWP

此生再无相见时 提交于 2019-12-10 11:55:25
问题 I have created a GridView which gets data through data binding. What I want to do next is make the GridView item width dynamic according to the Screen Size ( Like the ones they have done in the Windows 10 news, sports app, etc. ) So far I have done it successfully for minimum window width 0 using visual state manager by setting the horizontal alignment to stretch, but I am not being able to continue this for other wider window sizes. Any kind of help for sorting this out will be appreciated.

How can I have a gridview work horizontally in UWP?

落花浮王杯 提交于 2019-12-10 11:51:07
问题 I have a Gridview where I want items to be grouped and flow horizontally. The groups are still vertically scrolling. How can I fix this? 回答1: The ItemsPanelTemplate is the one that determines the layout of items. Usually an ItemsWrapGrid is used for a GridView. That control has a property called MaximumRowsOrColumns. Set that to the number of rows you want as a max on a page. The data is then always in a horizontal layout. You can add something like this: <GridView.ItemsPanel>

Difference between Task.WhenAll(Task.Run(async method)) and Task.WhenAll(async method)

霸气de小男生 提交于 2019-12-10 11:47:19
问题 I've been trying to figure out why the UI was blocking from a ViewModel method, and realized that this part of the code: await Task.WhenAll(getOutput1(), getOutput2()); was the problem. I managed to unblock the UI by using: await Task.WhenAll(Task.Run(() => getOutput1()), Task.Run(() => getOutput2())); getOutput1() and getOutput2() are both async with Task return types in the ViewModel, and the code is called from the View. What's the difference with calling Task.WhenAll when I call Task.Run(

UWP USB (Hid) Device Won't Connect

我们两清 提交于 2019-12-10 11:41:27
问题 This is my Hid library. It supports UWP, and Android. https://bitbucket.org/MelbourneDeveloper/hid.net/src/master/ This is an example of the library being used with the Trezor hardware wallet: https://github.com/MelbourneDeveloper/Trezor.Net I can connect to the Trezor with no problem on UWP, but I cannot connect to the KeepKey or Ledger which are other hardware wallets. This is the code I use to connect to both devices in my library. It looks through a list of devices, tries to connect and

Windows Universal App SetTitleBar

依然范特西╮ 提交于 2019-12-10 11:38:35
问题 I have a question about the Title'Bar sample from Microsoft's GitHub repository(https://github.com/JustinXinLiu/FullScreenTitleBarRepo/tree/master/FullScreenTitleBarRepo): In the AddCustomTitleBar function,there has a line: customTitleBar.EnableControlsInTitleBar(areControlsInTitleBar); EnableControlsInTitleBar is here: public void EnableControlsInTitleBar(bool enable) { if (enable) { TitleBarControl.Visibility = Visibility.Visible; // Clicks on the BackgroundElement will be treated as clicks

UWP save file in Documents and Pictures Library

五迷三道 提交于 2019-12-10 11:35:56
问题 I'm trying to make a UWP app which can export a file saved in his own storage into the document library. In Package.appxmanifest I've inserted the following lines: <uap:Capability Name="picturesLibrary" /> <uap:Capability Name="documentsLibrary" /> The code to get the path is this: StorageFolder storageFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.DocumentsLibrary); string path = storageFolder.Path + "\\" + fileName; The code to save the file is this