windows-runtime

how to prevent autoselection of first item in GridView on databind?

只愿长相守 提交于 2019-12-24 09:07:24
问题 When I databind my GridView to an ObservableCollection, the first item of the collection is automatically selected. The SelectionMode property of the GridView is set to multiple . Is there some way to prevent this auto-selection? Or on what event should I listen so that I can reset the SelectedIndex of the GridView back to -1? 回答1: Set the IsSynchronizedWithCurrenItem property to false on the gridview in xaml 回答2: There is acutally a pretty simple solution. I set the SelectionMode of the

How to display rtf in metro app?

一曲冷凌霜 提交于 2019-12-24 08:58:31
问题 How can I show rtf strings in a RichTextBlock (or any other UI text element)? There's no rtf property I could use (different from .net I think). And if I bind the string to the normal text property I only get the rtf code itself. So is there a way to do this? Otherwise I'd display the string as HTML in a WebView element. But I'd prefer a RichTextBlock. 回答1: Use a RichEditBox instead of RichTextBlock . You can inject RTF with RichEditBox.Document.SetText() method. RichTextBlock isn't an RTF

OfflineLicensesChanged event is never raised when trial license expires for a Windows 10 Store app

家住魔仙堡 提交于 2019-12-24 08:47:19
问题 I'm trying the following code for my Win32 app converted to UWP for the Windows 10 Store. The app is posted in the store under a trial license for 7 days. The goal of the code below is to receive a notification when the app's trial period expires: #include <Windows.Services.Store.h> #include <wrl.h> #include <wrl/event.h> //'hMainWnd' = HWND handle to the app's main window //ComPtr<IStoreContextStatics> storeContextStatics; //... ComPtr<IStoreContext> storeContext; hr = storeContextStatics-

WinRT: blocking Task

做~自己de王妃 提交于 2019-12-24 07:54:17
问题 I'm implementing network layer of my application, that is using an asynchronous JSON-RPC protocol. In order to communicate with the server, i'd like to make a method that will send a proper request, wait until the server sends response, and return it. Everything with use of async/await keywords. Here's simplified sample code: string response; Task<string> SendRequest(string methodName, string methodParams) { string request = generateRequest(methodName, methodParams); await Send(request); //

How to use CSS with Windows 8 Webview Control?

倾然丶 夕夏残阳落幕 提交于 2019-12-24 07:14:34
问题 I have a question about window's 8 apps Webview Control , is there anyway to use css to manage the look of the webview , i'm using it here to view a returned contents of a feeded html data but as you can see it's striped from all the CSS , so is there anyway that I can manage the CSS for the Webview ? UPATED : This is the code void ItemListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { // this code to populate the web view // with the content of the selected blog post. //

Windows 8 store app development without touch screen

穿精又带淫゛_ 提交于 2019-12-24 07:12:13
问题 I've started doing Windows 8 Store app development for some projects at work, but I do not have a touch screen device of my own at home. If I write a personal app for submission to the store, I must use my own hardware since I can't use the work computers for personal projects. My concern is getting into a situation where I submit an app to the store, then have touch-screen users describing issues that I can't replicate on a non-touch-screen device. Are there any functions or capabilities or

How to save ObservableCollection in Windows Store App?

北战南征 提交于 2019-12-24 07:04:55
问题 I am creating Windows Store App based on Split App template. What is the best way to save data from SampleDataSource for later use? I tried: Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings; roamingSettings.Values["Data"] = AllGroups; It throws exception: 'Data of this type is not supported'. 回答1: RoamingSettings only supports the runtime data types (with exception of Uri); additionally, there's a limitation as to how much data

How can I save a StorageFile to use later?

旧城冷巷雨未停 提交于 2019-12-24 06:52:11
问题 I am working in WinRT, and I am kind of stuck: I am writing a music player with a media library capability. I keep information about the music (such as artists etc) in a SQLite database. I wanted to let the user keep his music anywhere he wants to, instead of the windows way, where it all has to be in the 'Music' library. Users can add the music inside folders using a folder picker. The problem I have is this: how can I access these files later, e.g after the application restarts? Keeping the

Using Google Drive .NET API with UWP App

你。 提交于 2019-12-24 06:06:48
问题 I am attempting to use Google Drive as a storage location in my UWP application. I started at the quickstart provided by Google. I copy the code into a blank UWP project, change some of the output code ( Console.Writeline to a textbox.append method) and I try to build it. It fails to build and reports the error: Cannot find type System.ComponentModel.ExpandableObjectConverter in module System.dll I am running Windows 10 and VS 2015 and I have installed the sdk through NuGet. The example code

Setting Path.Data in code-behind

故事扮演 提交于 2019-12-24 05:33:14
问题 I have this XAML code which makes a Path which is inside a Canvas residing in a MainPage.xaml page. <Path x:Name="progressPath" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stroke="Gold" StrokeThickness="5" Canvas.Left="300" Canvas.Top="300" Height="305" Width="305" Data="m 150,0 A 150,0 0 0 0 150,0 A 150,150 0 0 0 150,0"> </Path> I want to have several Path 's like this one (for example, a new Path is made when the user taps a button), so I decided to create them in the