windows-runtime

Metro (XAML/C#): detect installation and/or first run

不问归期 提交于 2019-12-08 18:30:32
问题 When creating Metro applications in XAML/C#, how do I detect when the application is first installed or run for the first time since installation (or potentially upgrade)? I need to use this opportunity to ensure that my database schema is correct and potentially synchronise some base data. I had hoped that I could pick this up from the LaunchActivatedEventArgs within the OnLaunched method, but there does not seem to be a valid value for the Kind or PreviousExecutionState that I can use.

Why is [Windows::Foundation::Metadata::WebHostHidden] added by default in custom WinRT C++/CX controls?

江枫思渺然 提交于 2019-12-08 17:35:52
问题 When I create a new control in a WinRT C++/CX project, the class attribute [Windows::Foundation::Metadata::WebHostHidden] is added by default by Visual Studio 2012. Example: namespace WindowsRuntimeComponent1 { [Windows::Foundation::Metadata::WebHostHidden] public ref class MyUserControl sealed { public: MyUserControl(); }; } Is there any documented reason for this? (I did my homework but I failed to find this piece of information) As far as I know, using the attribute [WebHostHidden] makes

Where are the possible VisualStates for Windows 8 Metro controls documented?

不羁岁月 提交于 2019-12-08 17:28:32
问题 When writing a custom ControlTemplate (XAML) for a Win 8 Metro control we need to use the VisualStateManager to update the control according to VisualState transitions. I see the below sample all over MSDN, but I can't find where the VisualStateGroup "CommonStates" is documented and what other VisualStates are defined other than "PointerOver" and "Normal"? Do you have to go dig in the SDK to find the default ControlTemplate for a button? If so, where? <ControlTemplate TargetType="Button">

What are the risks of wrapping Async/Await IAsyncOperations with Task.Wait() code?

为君一笑 提交于 2019-12-08 17:22:48
问题 I'm currently trying to port a fair amount of existing synchronous code to WinRT. As part of this, I'm hitting problems with the existing code expecting some operations to be synchronous - e.g. for file I/O To adapt this existing code to work with the IAsyncOperation style API within WinRT, I've used a technique of wrapping the IAsyncOperation with an extension method like: namespace Cirrious.MvvmCross.Plugins.File.WinRT { public static class WinRTExtensionMethods { public static TResult

WPF RichTextBox SpellCheck ComException

时间秒杀一切 提交于 2019-12-08 17:00:55
问题 I've got an exception while trying to enable spell checking on some Windows 8.1 machines (both have latest updates, OS language is russian and .NET framework 4.7 is russian) saying: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Invalid value for registry (Exception from HRESULT: 0x80040153 (REGDB_E_INVALIDVALUE)) at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD) at

ResourceMap not found error when referencing a resource file within a portable class library

半城伤御伤魂 提交于 2019-12-08 16:39:27
问题 The problem I am facing has as follows: I have developed a portable class library to encapsulate a service connection. Inside this class library there is a Resources.resw file containing strings. These strings are called only by methods of the class library (for example to override ToString() methods). As I said this is a portable class library. If I reference it as a dll, or even as a project inside another solution, it gets built and compiles correctly. Then I make a call using a method of

WinRT/Metro Animation in code-behind

梦想与她 提交于 2019-12-08 15:55:31
问题 The following code works fine in Silverlight: private void Button_Click_1(object sender, RoutedEventArgs e) { Storyboard storyboard = new Storyboard(); DoubleAnimation doubleAnimation = new DoubleAnimation(); doubleAnimation.From = 50; doubleAnimation.To = 100; doubleAnimation.RepeatBehavior = RepeatBehavior.Forever; doubleAnimation.AutoReverse = true; doubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(200)); storyboard.Children.Add(doubleAnimation); Storyboard.SetTarget

VariableSizedWrapGrid and WrapGrid children size measuring

时光总嘲笑我的痴心妄想 提交于 2019-12-08 15:09:14
问题 Both VariableSizedWrapGrid and WrapGrid have strange measuring - they measure all children based on the first item. Because of that, the following XAML will clip the third item. <VariableSizedWrapGrid Orientation="Horizontal"> <Rectangle Width="50" Height="100" Margin="5" Fill="Blue" /> <Rectangle Width="50" Height="50" Margin="5" Fill="Red" /> <Rectangle Width="50" Height="150" Margin="5" Fill="Green" /> <Rectangle Width="50" Height="50" Margin="5" Fill="Red" /> <Rectangle Width="50" Height=

Alert sound in Windows Phone 8.1 App

守給你的承諾、 提交于 2019-12-08 14:48:50
问题 I am writing a Windows Phone 8.1 App (WINRT) . On click of a button, a beep must play . So i used MediaElement , but the problem is it pauses the MediaPlayer song . I even tried to change AudioCategory /Stream type but its not helping. Stream types Any solution? private void CreateMediaElements() { //WINRT: MediaElementObject = new MediaElement(); MediaElementObject.AudioCategory = AudioCategory.Alerts; MediaElementObject.IsLooping = false; MediaElementObject.Source = new Uri("ms-appx://

UWP How to get ListviewItem Currently clicked and Previously clicked

本小妞迷上赌 提交于 2019-12-08 14:31:28
I am developing UWP App, I have a Listview bind with a class, wherein upto 10 items. Listview have a DataTemplate and a Usercontrol is inside this DataTemplate. I want to click on any item so the animation (storyboard) should start and the ColorBand should expand toward right and when I click on another item now the expanded (previously clicked) ColorBand should collapse and the current clicked item's ColorBand should expand. This approach can be possible if I put this ColorBand inside the Listviewitem Style and use the Visual State Manager, but actually I need to put the border color and