windows-runtime

Force pivot item to preload before it's shown

我与影子孤独终老i 提交于 2019-12-07 04:20:29
问题 I have a Pivot with several PivotItems, one of which contains a canvas that places its items in dynamic locations (depending on the data). I get the data, and I can place the items in their place before the user can choose this item (this isn't the first pivot). However, only when I select the PivotItem, the canvas renders itself, so you can see it flicker before it's shown as it should. Is there a way to force the canvas to render before it's shown, so everything's prepared by the time the

How to implement IAsyncOperationWithProgress

血红的双手。 提交于 2019-12-07 03:40:02
问题 I'm porting some custom .NET streams to WINRT. Language is C#. Is there some example implementation of IAsyncOperationWithProgress? Since Methods ReadAsync, WriteAsync from Windows.Storage.Streams require them. Custom WinRT streams implementations are welcomed also. I found some C examples using create_async, but i'm looking to do this in C#, and i cannot find create_async in the Metro framework. Thanks in advance 回答1: For C#, you should check out this //build talk on async programming. If

Locked screen in windows 8 WinRT

你说的曾经没有我的故事 提交于 2019-12-07 02:21:48
问题 When my app is running in Windows 8 WINRT can I prevent the OS to go to locked screen/sleep mode? 回答1: You can use the DisplayRequest class to indicate that you are busy playing back something that requires the display to stay active and un-dimmed. A good how-to article with sample code is available here. Don't use it frivolously, it is quite detrimental to power consumption. Good odds that the Store will reject your app if you use it for no obvious benefit to the user. 回答2: You cannot

Making ScrollViewer's ScrollBar always visible through overriding or styling

眉间皱痕 提交于 2019-12-07 02:21:44
问题 I'm trying to make the ScrollBar for the ScrollViewer to be always visible so it doesn't only appear when I try to scroll the text view and so the user knows that there is someting more to see. At first, for some reason, I thought that I just have to change the color which needed brush overriding, but in reality, the ScrollBar is fading in and fading out, so either the ScrollViewer's or ScrollBar's template needs to be changed. I found the ScrollViewer's template which I have just placed in

Keydown Event fires twice

那年仲夏 提交于 2019-12-07 02:02:58
问题 On a Windows store App, I have this simple TextBox <TextBox Name="TextBoxUser" HorizontalAlignment="Right" Width="147" Margin="20,0,0,0" KeyDown="TextBox_KeyDown" / That has a KeyDown Event associated with it. private async void TextBox_KeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == Windows.System.VirtualKey.Enter) { Debug.WriteLine("LA"); } } And the output of this function is: LA LA although I press Enter only once, it prints 2 times. Any reason for that or am I doing something

How to place an XAML usercontrol in a grid

☆樱花仙子☆ 提交于 2019-12-07 01:59:47
问题 I have the following main.xaml and usercontrol. I need to place several times the user control on the 2nd row, 2nd column of the grid, By using visual studio it wont allow to drag and drop the user control, so I suppose I have to do it by code, I just dont know how MainPage.xaml <Grid HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="1366" x:Name="grid" Background="Black"> <Grid.RowDefinitions> <RowDefinition Height="150"/> <RowDefinition/> </Grid.RowDefinitions> <Grid

Why does HttpClient appear to deadlock here?

放肆的年华 提交于 2019-12-07 00:33:27
I have an API made in a portable class library which needs to reach out to platform specific APIs for sending HTTP requests. Here is the method I wrote to do an HTTP POST on WinRT: public bool Post(IEnumerable<KeyValuePair<string, string>> headers, string data) { bool success = false; HttpClient client = new HttpClient(new HttpClientHandler {AllowAutoRedirect = false}); foreach (var header in headers) { client.DefaultRequestHeaders.Add(header.Key, header.Value); } try { var task=client.PostAsync(endpoint, new StringContent(data, Encoding.UTF8, "text/xml")).ContinueWith( postTask => { try {

Why exposed types must be sealed for WinMD/WinRT components?

≡放荡痞女 提交于 2019-12-07 00:23:06
问题 VS compiler does not allow to create sealed exposed types for WINMD type library. Why is this restriction placed ? (I know about sealed types advantages, my question is with respect to Win RT components). 回答1: This is an architectural limitation, imposed by COM. Which sits at the core of any WinRT type, they are derived from IUnknown and IInspectable. The problem with COM is that it only supports interface inheritance but not implementation inheritance. Which was a strong COM design goal,

How to declare and link to RoInitialize,RoUninitialize,RoGetActivationFactory and HSTRING Functions in Mingw Gcc

拈花ヽ惹草 提交于 2019-12-07 00:02:19
问题 UPDATED: Added what RoInitialize looks like in roapi.h I am in the process of writing a pure C++11 WinRT library. I do not use WRL or C++/CX(Obviously if I want pure C++11). I got my code to compile and run on MSVC, but I want to see if I can get the code to compile and run on Mingw Gcc. Specifically I am using Gcc 4.7.2 obtained from nuwen.net. What I need at this point is a way to call the Windows API Functions RoInitialize RoUnitialize RoGetActivationFactory and the HSTRING Functions

WinRT and software ClearType font rendering

女生的网名这么多〃 提交于 2019-12-06 23:49:06
问题 Does WinRT provides an option to fall back to software ClearType font rendering (as Direct2D do via "Direct2D and GDI Interoperability") or we will be stuck with somewhat blurry hardware font anti-aliasing only? 回答1: No. Windows on ARM will not support ClearType. This is by design. Instead, Windows on ARM tablets will be required to have a high DPI. http://www.istartedsomething.com/20120303/cleartype-takes-a-back-seat-for-windows-8-metro/ 来源: https://stackoverflow.com/questions/7487080/winrt