winrt-xaml

How to handle the back button on WP 8.1 using MVVM light?

跟風遠走 提交于 2019-12-04 12:13:36
I'm searching for the appropiate way to handle the back button pressed event on Windows Phone 8.1 WinRT using the NavigationService available on MVVM light 5. So far I think the best place to do it is inside the ViewModelLocator by registering the GoBack method of the NavigationService while creating it following the approach outlined in NavigationService in MVVM Light V5 This is an effective approach. However, I can't handle validation before navigating back so I was wondering if there is a more suitable way to handle this event. public class ViewModelLocator { public ViewModelLocator() {

How to print Formatted Page which contain ListBox or GridView

纵饮孤独 提交于 2019-12-04 11:09:42
Printing Document using WinRT : 1) To Keep tracking if there are more data Or text data to print in a formatted page. This can be done using RichTextBlock and RichTextBlockOverflow like below: <RichTextBlock Foreground="Black" x:Name="textContent" FontSize="18" Grid.Row="1" Grid.ColumnSpan="2" OverflowContentTarget="{Binding ElementName=firstLinkedContainer}" IsTextSelectionEnabled="True" TextAlignment="Left" FontFamily="Segoe UI" VerticalAlignment="Top" HorizontalAlignment="Left"> </RichTextBlok> <RichTextBlockOverflow x:Name="firstLinkedContainer" OverflowContentTarget="{Binding ElementName

How to convert a Windows.UI.Color into a string color name in a Windows Universal app

不问归期 提交于 2019-12-04 10:41:53
I'm trying to convert a Windows.UI.Color into a simple string color name in my Windows 8.1 Universal app. I already have the ARGB values from the Color (even the hex code), and I just want its associated known name (for example, from #7AFF7A7A to "salmon"). Since System.Drawing is not available in WinRT, I cannot use ColorConverter or ColorTranslator. I've tried converting the Windows.UI.Color object into a SolidColorBrush or even a Brush, but none of them provide the name conversion capability. What's the best way of doing this? The Colors class contains named properties for many colors.

listview visual state manager in item template (WinRT, Metro, XAML)

为君一笑 提交于 2019-12-04 10:38:11
I am trying to get a listview to display a list of items made up of textblocks... when the listview item is clicked i would like to show instead a list made up of textboxes... Below is what i have come up with, it does not work. I have two grids within the templates and was hoping to simply show and hide the grids depending on if the listview item is selected. Where have i gone wrong? I ripped these visual states from the listview's template itself but i must admit im not sure how they work, or how they are meant to be triggered. Should there be some code behind to do this? <ListView Grid.Row=

Styling SelectedItem in ListView in Metro App XAML

与世无争的帅哥 提交于 2019-12-04 09:46:22
I am having troubles setting up the style of selected item in metro app list box. I have created the DataTemplate for the item in which there is a TextBlock which colour I would like to change. I tried many things from WPF but they are not available for metro like DataTemplate.Triggers, Style.Triggers and so on. I also tried to make a copy of the ItemContainerStyle template but since it uses ContentPresenter to display my DataTemplate I didn't know what to change to achieve what I want. The same was with value converter as I didn't know how to use RelativeSource to supply the converter with

How to get access to WriteableBitmap.PixelBuffer pixels with C++?

安稳与你 提交于 2019-12-04 09:41:22
There are a lot of samples for C#, but only some code snippets for C++ on MSDN. I have put it together and I think it will work, but I am not sure if I am releasing all the COM references I have to. Your code is correct--the reference count on the IBufferByteAccess interface of *buffer is incremented by the call to QueryInterface , and you must call Release once to release that reference. However, if you use ComPtr<T> , this becomes much simpler--with ComPtr<T> , you cannot call any of the three members of IUnknown ( AddRef , Release , and QueryInterface ); it prevents you from calling them.

Center popup in XAML

旧时模样 提交于 2019-12-04 08:15:44
I have created a Popup by using the following code, but I can not figure out how to center it I tried to automatically change the margin on runtime, but I could not figure out how to do it, but do anybody has an idea of how to center the popup? It does not has a standard-dimension cause I need to globalize my program <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Name="MainGrid"> <Popup x:Uid="LoginPopup" IsOpen="True" Name="LoginPopup"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto"/>

Windows 8 App The application called an interface that was marshalled for a different thread

走远了吗. 提交于 2019-12-04 06:14:33
I am working on a Windows 8 application using c#/XAML. Everything has been working except for this event handler where I get the following error on this line. await RefreshUserInfoAsync(); The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)) This Observable Collection is being updated from a push notification handler in the app class and this event handler is in my view model. I'm not using any frameworks like MVVM Light. I looked at some of the other posts on this and tried creating my own Dispatcher Helper

How to programmatically navigate in a FlipView with swipe animations

为君一笑 提交于 2019-12-04 04:18:37
The Windows Dev Center states regarding the UseTouchAnimationsForAllNavigation property: The XAML FlipView control supports three modes of navigation; touch-based, button-based and programmatic. When a user navigates by touch, the FlipView items scroll smoothly into view. When you set this property to true, the same navigation animation occurs whether the navigation is touch-based, button-based and programmatic. I'm currently navigating from my page's code behind by assigning the SelectedItem property of the FlipView: FlipView.SelectedItem = FlipView.Items.Last(); However, the swipe animation

How to draw string to a bitmap image in WinRT

▼魔方 西西 提交于 2019-12-04 03:49:08
问题 How do you draw a string to an image in winRT ? In WinForms that could be done using drawstring() method inside the system.drawing namespace but i couldn't find its equivalent in WinRT API. 回答1: Direct2D is a replacement for GDI in WinRT. So you'll have to use C++/CX with DirectX for drawing text. I don't have any examples for you, but maybe this link (and the links included) can help you on your way. 回答2: In Windows 8.1 they finally support rendering of XAML controls to bitmap. Now you can