winrt-xaml

How to bind to attached property in UWP?

喜欢而已 提交于 2019-12-10 14:22:46
问题 I need to bind a property of a control to an attached property in XAML (so that the attached property becomes a source of the binding), and I can't figure out how to do it -- VS2015 gives me " Value does not fall within the expected range " error, and when I run the app, I get an exception. The technique shown below worked perfectly in WPF. Here is the sample app demonstrating the problem. AttachedPropertyTest.cs: namespace App7 { public static class AttachedPropertyTest { public static

Global Dispatcher in WinRT?

帅比萌擦擦* 提交于 2019-12-10 13:55:20
问题 I have some WP7 code that looks like this: using System.Windows; using System.Windows.Threading; public static class GlobalDispatcher { public static Dispatcher Current { get { return Deployment.Current.Dispatcher; } } } What is the equivalent in WinRT? Is there no globally accessible Dispatcher (or CoreDispatcher) object? 回答1: You will want to use Window.Current.Dispatcher . 回答2: Just adding this as answer, as it better solves the problem in my opinion: Window.Current is null if the

MediaElement.MediaEnded event not firing

无人久伴 提交于 2019-12-10 11:58:12
问题 I have an app I'm porting from Windows Phone -> Windows 8 Store app. I play music via my App.Xaml.vb (so that it can play throughout my app and be controlled via CurrentApp). This all works great on the phone. When a music track ends, the MediaEnded event is fired and my app chooses another track and plays that. In Windows 8 when the first track ends the app goes silent. On Windows 8 the MediaElement.MediaEnded event doesn't fire . I set up my media element and add a handler: Public

windows store app trial period implementation

假如想象 提交于 2019-12-10 11:38:53
问题 On windows store app submission there is a place where it lets you specify a trial period (24 hours or 7 days...). In order to use this feature do i have to implement a code that kills the app after the specified time (The windows store option being just a declaration of the intention) or does the windows run-time handles the killing. 回答1: When you upload an app to the store you specify how long you would like a free trial to last for (a few days, all the way up to never expire). When the

Styling Windows Phone 8.1/WinRT AppBarButton

你离开我真会死。 提交于 2019-12-10 11:07:04
问题 I'm currently looking to implement a CommandBar for a WinRT Windows Phone 8.1 app. Overall it is very straightforward but I am unable to style the control. I have themed my app so that the accent colour has been changed to green. This works well for pretty much everywhere in the app (buttons, textblocks etc.) but not for the AppBarButton. The brushes I'm overriding are SystemColorControlAccentBrush and PhoneAccentBrush but changing these does not make any difference to the colour of the

Countdown timer for metro App

冷暖自知 提交于 2019-12-10 11:05:53
问题 I'm beginner in Metro Style Developing, I tried to make a small game that's need a timer, countdown from 10 to 0. But at this Visual Studio there is no Timer Component, and DispatcherTimer Not mapped to an xmlns. I Tried to use TimeSpan, that have this field "TicksPerSecond" But this example dosen't help me to make my countdown timer : http://msdn.microsoft.com/en-us/library/system.timespan.tickspersecond.aspx TimeSpan also have this method "FromSeconds", and i Can't also use this one for my

Page.OnNavigatedTo doesn't get called in Windows Store app

♀尐吖头ヾ 提交于 2019-12-10 10:37:48
问题 I have a Windows Store mess around app. I added a Basic Page and it added the Common classes, such as LayoutAwarePage. But Page.OnNavigatedTo doesn't get called when an app starts. The MSDN doc says: Invoked when the Page is loaded and becomes the current source of a parent Frame Which happens during launch. I discovered this when LoadState wasn't being called. Rick Barraza uses LoadState, which is called by OnNavigatedTo, in his demo: http://channel9.msdn.com/Series/Migrating-apps-from

How to have user prompt dialogs in Windows 8 metro apps?

微笑、不失礼 提交于 2019-12-10 10:11:25
问题 I would like to get some user inputs for my app like Name, DOB, etc from a modal window for this I need a dialog to be displayed which would contain the textboxes and other controls. Normally in WinForms/WPF I would create a class inherited from the Form/Window class and use the Show/ShowDialog method to present the form to the user How do I achieve this behavior in Windows 8 metro apps using XAML/C# ? I have looked at the MessageDialog class under the Windows.UI.Popups namespace but its for

CanExecute() returns true and button is still disabled

别等时光非礼了梦想. 提交于 2019-12-10 09:55:40
问题 I have a BottomAppBar.AppBarButton in a Windows Phone specific page, that is bound to a relay command. The code, binding and viewmodel implementation have all been used in basically the same way on other pages in the project and works exactly as expected there. The issue in this particular scenario is that the button remains disabled even after raising the .RaiseCanExecuteChanged() method, and the CanExecute() returns true . I originally thought that it might be due to excess calls to

How to show basic HTML Windows8 Metro style TextBlock?

北战南征 提交于 2019-12-10 05:48:04
问题 I have an html page that only contains <p> , <strong> , <br /> and <a> tags. I want to show this content in a XAML TextBlock in Windows 8. Is there any way to show that content in a TextBlock without losing the structure (e.g. paragraphs)? I don't want to use WebView because WebView can not be transparent. 回答1: I am developing a open source Windows 8 Metro RSS Reader app and I used HtmlUtilities.ConvertToText You can see the source code implementation here http://metrorssreader.codeplex.com