windows-runtime

BitmapImage returns 0 for PixelWidth and PixelHeight

南楼画角 提交于 2019-12-23 08:12:04
问题 I'm trying to do a super simple thing : get the size of an image. So I create my BitmapImage but I'm getting 0 when I try to access the PixelWidth and PixelHeight . How can I accomplish that please? EDIT: (added sample code) I'm just doing: var baseUri = new Uri("ms-appx:///"); var bitmapImage = new BitmapImage(new Uri(baseUri, "Assets/Logo.png")); MyImage.Source = bitmapImage; Debug.WriteLine("Width: " + bitmapImage.PixelWidth + " Height: " + bitmapImage.PixelHeight); In the console, I get:

Obtaining UI dispatcher in Windows phone 8

青春壹個敷衍的年華 提交于 2019-12-23 08:05:51
问题 I have been developing a Windows Phone application that consumes Windows Runtime component(WRC).A function accessed by a non-UI thread,needs to use a callback that access the Windows phone application. void WControlPointCallback::OnListChange(char *pFriendlyName) { // Callback function to access the UI pCallBack->AlertCaller("Message"); } At first without using the Dispatcher it threw Platform::AccessDeniedException . Then I referred to this, this and this. I tried to obtain the Dispatcher

Obtaining UI dispatcher in Windows phone 8

牧云@^-^@ 提交于 2019-12-23 08:05:15
问题 I have been developing a Windows Phone application that consumes Windows Runtime component(WRC).A function accessed by a non-UI thread,needs to use a callback that access the Windows phone application. void WControlPointCallback::OnListChange(char *pFriendlyName) { // Callback function to access the UI pCallBack->AlertCaller("Message"); } At first without using the Dispatcher it threw Platform::AccessDeniedException . Then I referred to this, this and this. I tried to obtain the Dispatcher

How to read a winmd (WinRT metadata file)?

橙三吉。 提交于 2019-12-23 07:00:40
问题 A WinMD is a binary medadata file, that contains everything you need to learn about namespaces, types, classes, methods, parameters available in a native WinRT dll. From Windows Runtime design : The Windows Runtime is exposed using API metadata (.winmd files). This is the same format used by the .NET framework (Ecma-335). The underlying binary contract makes it easy for you to access the Windows Runtime APIs directly in the development language of your choice. Each .winmd file exposes one or

Winrt Xaml Tapped Event Responds Slowly While Clicked Responds Rapidly

▼魔方 西西 提交于 2019-12-23 05:31:03
问题 I recently created a custom entry pad with buttons that the user may be clicking rapidly (it is basically a custom numeric entry pad). The problem is that if the button tapped event is used to register the handler for the entry pad key it responds so slowly that button presses are missed (meaning if I rapidly press the number 2 five times, maybe 2 or 3 twos show up). Changing the event from Tapped to Clicked (same code otherwise) causes the entry pad to be fully responsive. Why is it that the

How to subscribe to events properly in Windows Runtime apps?

旧巷老猫 提交于 2019-12-23 04:54:29
问题 I subscribe to OrientationChanged event in the constructor like this: public SecondPage() { this.InitializeComponent(); deviceOrientationSensor = SimpleOrientationSensor.GetDefault(); if (deviceOrientationSensor != null) { deviceOrientationSensor.OrientationChanged += OrientationChanged; } } and then: private void OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args) { deviceOrientation = args.Orientation; // the rest... } So the problem

(WinRT)How to get TextBox caret index?

南楼画角 提交于 2019-12-23 04:49:23
问题 I got some problems with getting caret index of TextBox in Windows Store App(WP 8.1). I need to insert specific symbols to the text when button is pressed. I tried this: text.Text = text.Text.Insert(text.SelectionStart, "~"); But this code inserts symbol to the beginning of text, not to the place where caret is. UPDATE I updated my code thanks to Ladi. But now I got another problem: I'm building HMTL editor app so my default TextBlock.Text is: <!DOCTYPE html>\r\n<html>\r\n<head>\r\n</head>\r

Caliburn Micro GoBack to previous page instance WinRT

柔情痞子 提交于 2019-12-23 03:46:08
问题 I am using Caliburn.Micro.Core.2.0.1 on Windows Phone 8.1 (WinRT) application All my ViewModels extends Screen as the base. In my MainView(Model) I am able to navigate to a SettingsView(Model) with CM's INavigationService using private readonly INavigationService _navigationService; public void Navigate() { _navigationService.NavigateToViewModel<SettingsViewModel>(_param); } Then using the Hardware Back Button or public void GoBack() { _navigationService.GoBack(); } I can navigate back to the

Can't fire PointerPressed event from a Listbox in WinRT

雨燕双飞 提交于 2019-12-23 03:11:35
问题 I have a ListBox bound to some data, all with an ItemTemplate set, I want to fire PointerPressed Event from this list by pressing anywhere in the ListBox area (cause I just need that for some purpose), but apparently the Selection of the items is preventing that, (I'm using commands) here's my code <ScrollViewer x:Name="sv" x:FieldModifier="public" VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled">

UWP/WinRT: How to enable undo hooks on a TextBox?

怎甘沉沦 提交于 2019-12-23 02:53:43
问题 The TextBox class already supports undo, as it is present and functional in the context menu. I would like to implement undo/redo buttons as found in every common document editor such as Microsoft Word. They would be disabled when they have no action to take, and when there is an undo/redo stack to move through, pressing the buttons would cause the TextBox's contents to undo and redo. Looking at the TextBox API, there doesn't seem to be any mention of how to hook into the undo data. The only