windows-runtime

How to gain access to KnownFolders.DocumentsLibrary

主宰稳场 提交于 2019-12-07 12:15:49
问题 I'm trying to save a string of user inputs to a file in a windows runtime app. However I'm getting the error System.UnauthorizedAccessException . How do I gain access to this Library? static private async Task WriteDataToFileAsync(string fileName, string content) { byte[] data = Encoding.Unicode.GetBytes(content); var folder = KnownFolders.DocumentsLibrary; var file = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); using (var s = await file

Single Row Horizontally Scrolling/Swipeable GridView

妖精的绣舞 提交于 2019-12-07 10:23:20
问题 I wanted a single-row GridView that can be scrolled horizontally both with mouse and touch swipe. The GridView is to present images through binding so that a single image will be selected from an array of images. Everything works fine (binding, image selection, etc.) except that the horizontal scroll doesn't work. The XAML code is shown below. What am I missing? <GridView x:Name="IconGridView" Grid.Row="0" Margin="8,12" DataContext="{x:Bind IconManagerObj}" DoubleTapped="{x:Bind IconGridView

List of assemblies in the .NET for Windows 8 profile

淺唱寂寞╮ 提交于 2019-12-07 10:17:13
问题 I am looking for the list of assemblies in the ".NET for Windows 8" profile. This is the profile used for WIndows 8 Metro-style applications, and like Silverlight doesn't use the full .NET framework. 回答1: .NET for Metro style apps — list of namespaces Converting your existing .NET Framework code — changes to the various APIs. 回答2: I don't see any list currently... and WinRT is expected to change alot till the official release in 2012... current information about assemblies/not available in

How do I detect multitouch actions in a Windows 8 metro app?

点点圈 提交于 2019-12-07 09:58:49
问题 I am working on a metro app right now and I'm looking to enable multitouch. I've browsed around google, but I can't seem to find any API to support it. Can someone point me in the right direction to support multitouch actions in a Windows 8 Metro app? 回答1: What exactly are you trying to do? There are Touch, Pointer (an abstraction around touch/mouse/stylus), and Manipulation events on every UI element 回答2: In JavaScript you can use the event.pointerId to detected multiple touch inputs. This

SignalR and WinRT client: Don't call Wait() on Start()

折月煮酒 提交于 2019-12-07 09:38:29
问题 I have a question regarding SignalR's official documentation - Hubs API Guide - .NET Client. In the section - How to establish a connection . It has been written the following thing: The Start method executes asynchronously. To make sure that subsequent lines of code don't execute until after the connection is established, use await in an ASP.NET 4.5 asynchronous method or .Wait() in a synchronous method. Don't use .Wait() in a WinRT client. Does anyone know what is the specific reason not to

How to Interop with Windows Runtime in .NET 4.5

和自甴很熟 提交于 2019-12-07 08:49:17
问题 I see this namespace: System.Runtime.InteropServices.WindowsRuntime Which provides interop between .NET and WindowsRuntime. For instance, you can invoke a method in WindowsRuntime when you create a Metro application, as Metro uses WindowsRuntime, like Windows.System.UserProfile.UserInformation But when you create a normal .NET console application or WPF application, you can no longer directly reach WindowsRuntime namespaces such as Windows.System I wonder if it were possible to invoke

XBF Error with DataTemplate in Application.Resources

好久不见. 提交于 2019-12-07 08:49:03
问题 Universal Windows Platform app with Visual Studio 2015 (RTM) I have a DataTemplate that is used in multiple pages of my app, so I'd prefer to write it once and access it from anywhere I need to. In order to make it accessible by any page, I write it in my App.xaml 's <Application.Resources> : <Application x:Class="MyApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MyApp" xmlns:viewmodels="using

How to detect unplugged headphone jack in WinRT?

本小妞迷上赌 提交于 2019-12-07 08:44:27
问题 Is there a way to get notified whenever a headphone jack is unplugged in a WinRT app? I want to be able to pause MediaElement playback when it happens to prevent the sound from leaking out through loudspeakers. 回答1: Jack detection notification is exposed through IMMNotificationClient::OnDeviceStateChanged. Just tried it on win8 desktop, OnDeviceStateChanged gets called with DEVICE_STATE_UNPLUGGED and DEVICE_STATE_ACTIVE when (un)plugging a device. Sadly that part of wasapi is documented as

How do I dynamically size a GridView Item?

牧云@^-^@ 提交于 2019-12-07 08:32:26
问题 I have a Grid View that is used to display "tags" which is a list of strings that are dynamic in size. Using the following code: <GridView ItemsSource="{Binding Tags}" ItemTemplate="{StaticResource TagTemplate}" VerticalAlignment="Bottom" Grid.RowSpan="2" SelectionMode="None" /> I use the following Template for the items: <DataTemplate x:Name="TagTemplate"> <Border BorderBrush="Gray" BorderThickness="1" Opacity="75"> <TextBlock Text="{Binding}"/> </Border> </DataTemplate> When added to the

F# type providers with Portable Library

こ雲淡風輕ζ 提交于 2019-12-07 08:27:28
问题 I'm building a Windows 8 application and am finding myself wanting to include a list of ISO-4217 codes, which I have in up-to-date form in XML. Naturally, there are a couple of these codes for all countries. I figured a Type Provider would be an excellent fit. However, since they emit code, I can't use them with Portable Libraries. How do I compile the type provider so that it doesn't use emit, in order to use the XML I've got? 回答1: I don't have experience with creating a Type Provider that