uwp

How to preserve white-spaces of TextBlock in UWP apps

[亡魂溺海] 提交于 2019-12-12 10:46:59
问题 If you simply set the value of Text property in a TextBlock as " Example " (Note that there 3 whitespaces at the end of this string),what TextBlock shows in UI is just " Example ". And after searching for solutions on the Internet, I found that there is a way to solve this issue: <Border BorderThickness="1" BorderBrush="#FFFF0202" HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock x:Name="t1"> <Run Text="Example   "/> </TextBlock> </Border> The above code shows the use of

How to bind absolute coordinates of a shape/control inside Canvas

非 Y 不嫁゛ 提交于 2019-12-12 10:24:06
问题 On a Windows 8.1 Metro app, I'm trying bind a collection of shapes from my view model into MainPage.xaml. Each shape will have a Left , Top and also a PathData which will be a RectangleGeometry that contains the rectangle that I want drawn inside the canvas at the corresponding position. This is the XAML : <Grid Background="Black"> <ItemsControl ItemsSource="{Binding Shapes}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel>

How to change Color define in Xaml Resources in code (UWP)

旧街凉风 提交于 2019-12-12 09:46:47
问题 [UWP] I have many grids with color binding from App.xaml MainPage.xaml ... <Grid Height="45" Margin="0,0,0,10" Background="{ThemeResource MyColor}"> App.xaml <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" RequestedTheme="Dark"> <Application.Resources> <ResourceDictionary> <SolidColorBrush x:Key="MyColor">#FFFFFF</SolidColorBrush> Then I want to change all of its, in code like this Application.Current

Detect if share UI is supported in current device (UWP)

回眸只為那壹抹淺笑 提交于 2019-12-12 09:41:43
问题 I have created a UWP app for windows 10 devices using c#/xaml. In the app, i have a share functionality that calls DataTransferManager.ShowShareUI() This works as expected on desktop, tablet and mobile devices. But on my xbox, the above method does not launch the share UI. Nor does it throw any exceptions. After searching online a bit, I found this article that says share contract is not supported on xbox. And no share UI is displayed. But this gives a bad user experience. So I have 2 options

C# UWP XAML- Updating controls “synchronously”

随声附和 提交于 2019-12-12 09:28:19
问题 Throughout this question, I've included some links which show that I've done some work searching for a solution. I'm developing a UWP app with touchscreen and GPIO. UI has a stop button, a reset button, and a textblock. GPIO is used for a physical start button, a motor, and 2 limit switches. Motor can rotate until it runs into a limit switch. Code to control the hardware (e.g., Motor.Forward()) has been written and tested, but is excluded from this question for brevity. Code for the stop

Using ThreadPoolTimer with Background Audio UWP

早过忘川 提交于 2019-12-12 09:24:00
问题 I am making a UWP app using the BackgroundAudioTask. My app is working very well. Now I want to add in a TextBlock the Current position of the Audio played. I was doing this method before implementing the audio Task: private TimeSpan TotalTime; private DispatcherTimer timerRadioTime; private void radioPlayer_MediaOpened(object sender, RoutedEventArgs e) { TotalTime = radioPlayer.NaturalDuration.TimeSpan; // Create a timer that will update the counters and the time slider timerRadioTime = new

UWP BarcodeScanner Preview: CaptureElement doesn't show any Preview

╄→гoц情女王★ 提交于 2019-12-12 09:23:04
问题 My CaptureElements are showing strange behavior. When I set a instantiated MediaCapture as the CaptureElements Source and then call MediaCapture.StartPreviewAsync() the CaptureElement doesn't show anything. I have one Application (main-app) with a functional BarcodeScanner on the LoginPage. -> Works! Then I wanted to copy the same code to the SettingsPage with small modifications so in case of several attached cameras, the default one can be set. -> Doesn't work Then I tried to run the main

Insufficient memory to continue the execution of the program when trying to initialize array of InkCanvas in UWP

主宰稳场 提交于 2019-12-12 09:16:36
问题 Here is my code: public sealed partial class MainPage : Page { InkCanvas[] arrInkCanvas = null; public MainPage() { this.InitializeComponent(); int i = 0; arrInkCanvas = new InkCanvas[1000]; try { for (i = 0; i < 1000; i++) { arrInkCanvas[i] = new InkCanvas(); } } catch (Exception ex) { } } } When i run this code in WPF app there's no problem , but in UWP it throws exception : "Insufficient memory to continue the execution of the program." Is it bugs or something can anyone tells me ? Thanks.

Set custom WebView header in UWP

坚强是说给别人听的谎言 提交于 2019-12-12 08:49:42
问题 This could seem to be duplicates of other similar questions but they are old thread and not specific to Windows UWP apps. I'm unable to set custom header in WebView so the loaded URLs in WebView could work for me. I have seen many forums giving solution like using HttpClient/WebRequest with header but that doesn't work as in my case, the web address usage Javascript for redirection and before redirection it needs few custom header to load correctly. Also WebView.NavigateWithHttpRequestMessage

Connecting UWP apps hosted by ApplicationFrameHost to their real processes

痴心易碎 提交于 2019-12-12 08:29:30
问题 I am working on an WPF application to monitor my activities on my computer. I use Process.GetProcesses() and some filtering to get the processes I am interested in (example:Calculator) then I record their StartTime. I am also using WIN32/USER32 API method GetForegroundWindow() to get the window the user is using. The problem is that when the windows are Windows/UWP applications they are always hosted by the process ApplicationFrameHost. So the GetForegroundWindow() method returns that window