win-universal-app

How can I simulate a DeviceLost event with Win2D?

醉酒当歌 提交于 2019-12-03 13:49:30
问题 I have a CanvasControl in a UWP app and I've noticed when I leave my Surface alone for a while and it goes to sleep automatically, the CanvasControl no longer works after resuming. The previously drawn bitmap is now blank. I tried to simulate Suspend/Resume in Visual Studio 2015, but that doesn't seem to cause a problem. It resumes fine. I have a feeling it has to do with the CanvasDevice.DeviceLost event, and although I manage that with the CanvasControl.CreateResources event, I can't find a

Dark/Light theme assets qualifiers

守給你的承諾、 提交于 2019-12-03 13:35:49
I have a very simple requirement to use Light/Dark themed images. I expected that a qualifier like SomeImage.Theme-Light.png or putting the image under a folder named Theme-Light Theme-Light/SomeImage.png would work, and it did, but only in the designer mode. As soon as I run the app, even though the required theme is properly set (on both app and page level so all the other ThemeResources get loaded correctly), wrong image gets loaded. I know about workarounds to load different images for different themes, so that's not what I'm looking for. I am curious to know why this approach with

UWP DataTemplates for multiple item types in ListView

别来无恙 提交于 2019-12-03 12:52:26
How would I go about implementing this? Let's say this is my model: public interface IAnimal { string Name { get; } } public class Fish : IAnimal { public string Name { get; set; } public int ScalesCount { get; set; } } public class Dog : IAnimal { public string Name { get; set; } public string CollarManufacturerName { get; set; } } public class ViewModel { public ObservableCollection<IAnimal> Animals { get; set; } public ViewModel() { this.Animals = new ObservableCollection<IAnimal>(); this.Animals.Add(new Fish { Name = "Carl", ScalesCount = 9000 }); this.Animals.Add(new Dog { Name = "Fifi",

Override theme brush Windows 10 UWP

回眸只為那壹抹淺笑 提交于 2019-12-03 12:41:59
I'm trying to override some style-colors in Windows 10 but I cannot get it to work. My app.xaml looks like this: <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources.xaml"/> </ResourceDictionary.MergedDictionaries> <ResourceDictionary.ThemeDictionaries> <ResourceDictionary x:Key="Default" Source="Theme.xaml"/> </ResourceDictionary.ThemeDictionaries> </ResourceDictionary> </Application.Resources> And my Theme.xaml looks like this <ResourceDictionary x:Key="Default" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/

How to horizontally align AppBarButton in command bar

三世轮回 提交于 2019-12-03 12:23:45
问题 I want to align my single AppBarButton to the right on a CommandBar in a Page.BottomBar ? In design it shows the app bar button at the right side but in the emulator, the button is always at the center? Is there a way to align AppBarButton in a page bottom bar ? Edit: <Page.BottomAppBar> <CommandBar HorizontalAlignment="Right" HorizontalContentAlignment="Right"> <CommandBar.PrimaryCommands> <AppBarButton Margin="100,0,0,0" HorizontalAlignment="Right" HorizontalContentAlignment="Right"

Is it possible to use a portable library with localized resources in a Universal app?

眉间皱痕 提交于 2019-12-03 10:19:58
问题 (There's a link at the bottom to a solution with repro of the problem.) I've been using a portable library with .resx resources for quite some time as it worked for both Windows Store apps and Windows Phone apps. I tried to use it with a Universal app as well, and it works for the Windows Store part, but does not work for Windows Phone. The problem occurs only when I try to deploy the app on a device (built with the Release configuration). If I just Build it, it does not give an error (but it

Can I create an alarm app for Window Universal App?

最后都变了- 提交于 2019-12-03 10:08:55
问题 I would like to create an alarm app. I found the way of operating a timer in the background. But APIs which control the power of the display were not found(I want to turn on the display's power when its power is off). Doesn't Windows 10 (Windows Universal App) have enough APIs to create that app? 回答1: Windows-universal-samples has recently been updated with a few new RTM samples including this one - Notifications. As Alarm is also one type of notification, it's now built within a new toast

Universal Windows project - HttpClient exception

孤街浪徒 提交于 2019-12-03 09:18:45
I'm trying to implement REST client in Universal Windows project (in Windows 10 universal app) using HttpClient, but the following line: var response = _client.GetAsync(address).Result; throws an AggregateException with the following message: Access denied. A network capability is required to access this network resource More surprisingly, the request isn't event sent to server. How can I solve this problem? Double click on the Package.appxmanifest file in your project. Click on the "Capabilities" tab. Add the Private Networks capability to your project. 来源: https://stackoverflow.com/questions

Adding BasedOn Style on App.xaml is crashing on App() { InitializeComponent(); }

妖精的绣舞 提交于 2019-12-03 08:53:49
Adapting an project to Template10 , I go into inherited styles in App.xaml are crashing. It looks like Template10 , doesn´t support inherited or extended styles. I was trying to extend SubTitleStyle from TitleStyle but I get an COM exceptions on GetXamlType in XamlTypeInfo.g.cs My App.xaml.cs sealed partial class App : BootStrapper { public App() { InitializeComponent(); } public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args) { NavigationService.Navigate(typeof(ShellView)) await Task.CompletedTask; } } My App.xaml <Style x:Key="TitleStyle" TargetType="TextBlock

Logger for Windows 10 UWP app

时光怂恿深爱的人放手 提交于 2019-12-03 08:29:42
问题 I couldn't found any loggers for windows 10 universal app, i have tried out log4net, Microsoft enterprise library, Nlog but none of them are supported in windows 10 Universal platform. Can anyone suggest me good logger for the windows 10 UWP? 回答1: Have you tried MetroLog? You can install it using NuGet: Install-Package MetroLog Here's an quick example: using MetroLog; using MetroLog.Targets; LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new