windows-runtime

Binding ItemsSource programmatically

早过忘川 提交于 2019-12-05 21:34:54
问题 What is the equivalent of this in c# code? <ListView x:Name="taskItemListView" DataContext="{Binding SelectedItem, ElementName=itemListView}" ItemsSource="{Binding taskItems}"> ... </ListView> I've tried the following code, but it doesn't seem to work... Binding b = new Binding(); b.Path = new PropertyPath("taskItems"); DependencyProperty dp = DependencyProperty.Register("itemsSource", typeof(object), typeof(object), null); BindingOperations.SetBinding(taskItemListView, dp, b); Edit : Based

ICMP Ping in WinRT - Is it possible? [duplicate]

不羁的心 提交于 2019-12-05 20:27:57
This question already has an answer here: Is it possible to write a Ping class in C# that will run within Windows 8 Metro environment? 1 answer How to do an ICMP ping in a WinRT Modern UI application? Ping is not implemented in WinRT currently (see related question here ) and the previous strategies in Silverlight being: Use a WCF Service Call Javascript which then calls an ActiveX component Give up ( here ) Vasily here uses http to 'ping' a webserver on a specific port using StreamSocket which supports network communication using a TCP socket. Perhaps Windows.Networking.Socket s is the

How to gain access to KnownFolders.DocumentsLibrary

半城伤御伤魂 提交于 2019-12-05 19:39:24
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.OpenStreamForWriteAsync()) { await s.WriteAsync(data, 0, data.Length); } } "Documents library" capability in Visual Studio

List of assemblies in the .NET for Windows 8 profile

非 Y 不嫁゛ 提交于 2019-12-05 19:27:34
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. .NET for Metro style apps — list of namespaces Converting your existing .NET Framework code — changes to the various APIs. 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 the "Metro/WinRT Client profile": http://blogs.microsoft.co.il/blogs/sasha/archive/2011/09/17/metro-net-framework

Reuse animations in Windows 8

允我心安 提交于 2019-12-05 19:16:38
I am building Windows Store Application (Winrt, Metro, Windows 8 app). I try give images in gridview animation: after image is loaded from web and opened it populates its cell. I have storyboard for that: <Storyboard x:Name="PopupImageStoryboard"> <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="image"> <EasingDoubleKeyFrame KeyTime="0" Value="100"/> <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="240"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True"

How to read Windows.UI.XAML.Style properties in C#

帅比萌擦擦* 提交于 2019-12-05 18:51:42
I am writing a class that will convert a HTML document to a list of Paragrpahs that can be used with RichTextBlock in Windows 8 apps. I want to be able to give the class a list of Styles defined in XAML and the class will read useful properties from the style and apply them. If I have a Windows.UI.XAML.Style style how do I read a property from it? I tried var fontWeight = style.GetValue(TextElement.FontWeightProperty) for a style defined in XAML with TargetProperty="TextBlock" but this fails with and exception You could try this: var fontWeightSetter = style.Setters.Cast<Setter>()

FreeType “generic” conflict with c++/cx keyword

社会主义新天地 提交于 2019-12-05 18:40:46
问题 I have a problem with putting c++ and c++/cx together. I need to use FreeType library, but they are using "generic" name for some variable. I also need to enable VC++ extensions because WinRT app, which causes name conflict (generic is keyword in c++/cx) 1>freetype2\include\freetype\freetype.h(1391): error C2059: syntax error : 'generic' I only added freetype reference and aditional include directories to my project properties. Is there some way to solve this case? Thank you for your help :)

How to add text to Clipboard in Windows Phone Runtime?

淺唱寂寞╮ 提交于 2019-12-05 18:39:40
问题 previously in Windows Phone 8 we could use Clipboard to share text. It's supported in Windows 8, Clipboard.SetContent(dataPackage); But I see it is not supported for Windows Phone Runtime. Is it not possible anymore or there is another way to do that? 回答1: You pretty much answered your own question. Clipboard APIs are currently available only on Windows Phone Silverlight 8.0 and 8.1, and not on Windows Phone WinRT. More info: Windows Phone 8.1 for Developers - Choose your Windows Phone XAML

winrt: load local html and its resources in webview

旧时模样 提交于 2019-12-05 18:38:45
I'm currently developing a WinRT app where I load local HTML files from Windows.Storage.ApplicationData.Current.LocalFolder . I like to know what would be the best way to load assets like Images, Audio, Video, CSS, JavaScripts, etc, that are embedded in the HTML file. Currently, I'm writing these files in the Windows.ApplicationModel.Package.Current.InstalledLocation but this wont be accessible anymore once the application had been deployed from the store or by installing the AppPackage through Windows PowerShell, unless you change the ownership of the "Program Files/WindowsApps" folder to the

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

冷暖自知 提交于 2019-12-05 16:58:40
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 call Wait()? Also, does also this apply when I have a WinRT client where I have a call with hubProxy