windows-runtime

Why am I getting a “package could not be registered” deployment error on Windows 10 UWP?

百般思念 提交于 2019-12-11 04:07:51
问题 I have an application targetted for Windows 10 and the UWP. The application correctly runs for x86 and x64 but when I try to run it on a mobile device targetting ARM on a Nokia Lumia 820 I get an error message during deployment: DEP0001 : Unexpected Error: Package could not be registered. (Exception from HRESULT: 0x80073CF6) There are other questions relating to this error that suggest it could be an issue with shared user certificates or that you can't have Audio and Device use in the same

UWP/XAML: How to inherit from the default styles using BasedOn?

只愿长相守 提交于 2019-12-11 04:03:36
问题 The official Microsoft article states: Modify the default system styles You should use the styles that come from the Windows Runtime default XAML resources when you can. When you have to define your own styles, try to base your styles on the default ones when possible (using based-on styles as explained earlier, or start by editing a copy of the original default style). I understand that you can copy and paste the default style from MSDN in order to "start by editing a copy of the original".

HttpClient missing response headers in WinRT / Win8

浪子不回头ぞ 提交于 2019-12-11 03:58:29
问题 I'm using HttpClient in a Windows 8 app and it seems that it purposely hides custom headers in the response. For example: Our response received has a custom header called "Sample-Header: 123" I expect that the headers in the response content would contain "Sample-Header" with a value of "123" var client = new HttpClient(); var response = await client.GetAsync(uri); string sample; IEnumerable<string> values; if (response.Content.Headers.TryGetValues("Sample-Header", out values)) { // This

Save the page state when navigating out

北城以北 提交于 2019-12-11 03:37:40
问题 Say I have two pages, A and B. The user can modify things on page A then navigate to page B. When he is on page B, he clicks the "Back" button to go to page A. Everything that has been done previously is lost. There is a way to get the exact same state by using this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled; But is there a way to know whether the page is opened for the first time a by using the back button? 回答1: yes it is: protected override void

Change global application font in a Windows 8.1 app

左心房为你撑大大i 提交于 2019-12-11 03:32:13
问题 There are lots of articles online about how to embed custom fonts, create font styles and apply them to controls. But how can one override the global application font such that each control uses that font instead of setting the FontFamily property manually for each control. In my case, I do not wish to use a custom font as the global font but a system font such as Tahoma or Calibri. 回答1: In winrt default Fontfamily for all controls ContentPresenter is Segoe Ui and its key is

ConnectAsync blocking UI Thread

本秂侑毒 提交于 2019-12-11 03:31:14
问题 I have simple WinRT application, that will be communicating with remote server via TCP. In order to do that I'm creating new StreamSocket object, and connecting to remote server after clicking a proper button, like this: private async void ConnectButtonClick(object sender, RoutedEventArgs e) { StreamSocket socket = new StreamSocket(); HostName host = new HostName("192.168.1.15"); await socket.ConnectAsync(host, "12121"); } The problem is that this code is blocking the UI thread. I've created

Embedded Xaml pages on DLL

亡梦爱人 提交于 2019-12-11 03:27:07
问题 I am developing some UI components with the new Metro Design (WinRT) in order to provide them to a third party company. We are having some trouble deploying the package of the controls. When they reference our .dll files produced by our controls on a new Project, they can access all the objects and instantiate them, but when compiling, an error of the type: "Payload file '...\bin\Debug\Charts\Line\Line.xaml' does not exist." . (if we provide the /bin .dll) OR XamlParseException at Windows.UI

Simple radial gradient background in Metro-Style App

≡放荡痞女 提交于 2019-12-11 03:16:17
问题 What would be a simple way of drawing a radial gradient background (also being able to change it's color) in a XAML/C# Metro-Style App ? Is using DirectX an option ? I tried looking at some SharpDX samples for Windows 8 Consumer Preview but failed to compile them. Haven't found any other samples of using DX in C# on Windows 8. Any ideas ? 回答1: RadialGradientBrush has not been added to the XAML stack yet. You can use WriteableBitmapEx to draw the gradient to a WriteableBitmap yourself and then

WinRT ViewModel DataBind to async method

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:14:47
问题 I am deserializing a list of objects from an XML file, and would like to bind to the actual content of those objects in my View, passing over a ViewModel. The problem is that file operations are async and this bubbles all the way up to the ViewModel, where Property getters cannot be marked as such... Problem I deserialize all XML files in a folder to Profile objects and store them in a List<Profile> . This method (has to be) marked async . public static async Task<List<Profile>>

What is the ComposableAttribute in WinRT?

谁说我不能喝 提交于 2019-12-11 03:14:12
问题 I'm trying to understand how some of the more lower-level portions of WinRT work. I came across the ComposableAttribute which may be the key to what I need. However, the documentation on it is very thin. Indicates how a programming element is composed. As you can tell, that doesn't actually tell me anything. Does anyone know what this attribute is used for and what it is suppose to do? 回答1: The ComposableAttribute marks a type as being instantiable for use as a base class across the Windows