uwp

How to add back button event in Universal Windows App without using WinjS Library?

邮差的信 提交于 2019-12-10 19:06:34
问题 This is my main.js (function () { "use strict"; //No need of WinJS var activation = Windows.ApplicationModel.Activation; var roaming = Windows.Storage.ApplicationData.current.roamingSettings; // For App Start Up Windows.UI.WebUI.WebUIApplication.addEventListener("activated", function (args) { if (args.detail[0].kind === activation.ActivationKind.launch) { if (roaming.values["currentUri"]) { if (roaming.values["UserName"]) { localStorage.setItem("UserName", roaming.values["UserName"]); window

[UWP]Resize, compress and get base64 string from BitmapImage

一个人想着一个人 提交于 2019-12-10 18:54:43
问题 this is my first thread! I'm rewriting my application developed in Silverlight 8 (WP8) in UWP. I have a problem obtaining a base64 encoded string from a BitmapImage. I'm working without being able to find a solution from many days :-( . In summary i need to: -Select an image from device gallery -Cut out the selected image to 1 MegaPixel(1024* 1024) -Compress the selected image -Obtain the base64 encoded string from compressed image My Silverlight 8 code (WORK): Private Sub attachButtonHan

Converting String Type To Windows.UI.Color In Windows Universal App

核能气质少年 提交于 2019-12-10 18:54:17
问题 I'm trying to make a program to parse xml files with predefined format, and add some UI controls to my MainPage in Windows Universal Application. In some part, I need to specify the background color of my TextBlocks in related xml file, so I'm looking for a way to convert string attribute, read from xml and convert it to Windows.UI.Color corresponding value. here is my xml file and my C# code to add control xml : <test-unit name ="FOG_LAMP" text ="Fog Lamp" mode ="DIG_IN" color="ORANGE"/> C#:

List of all physical drives

末鹿安然 提交于 2019-12-10 18:28:50
问题 How to get list of all physical drives in UWP (Windows 10) App? I'm try to use Windows.Storage.KnownFolders , but this way I can get only folders from Library. 回答1: I know you asked this question a long time ago, but I created a question (Get Internal Drives Using Windows.Storage Namespace in UWP) to provide my method for getting internal drives and encourage feedback/discussion on a better alternative. I had exactly the same problem to solve and everything else I can find online doesn't fit

Updating ListView's ItemsSource via INotifyPropertyChanged

删除回忆录丶 提交于 2019-12-10 18:28:01
问题 While answering other question I've stepped into one thing I try to understand. I've a ListView , which ItemsSource is bound to a property of my page. The page implements INotifyPropertyChanged , the DataContext is set, evrything works, I can see my list rendered on the screen. But if I change something inside one of the elements and raise property changed on the whole collection, the change is not visible on the screen, the getter is called, so the binding works, but nothing changes. Why is

How to log data binding exceptions in Windows 10 UWP apps using Application Insights?

孤者浪人 提交于 2019-12-10 18:27:48
问题 I want to ensure that I am aware if my team introduces data binding errors within our Windows 10 UWP apps that we are building. XAML data binding errors have silently failed (for better or for worse) since the beginning days of WPF. There were imperative ways to hook onto data bindings available in .NET but that's not what I'm looking for as I want to be able to use declarative (XAML-based data bindings). I'm looking for a global hook kind of like the "UnhandledException" event in App.xaml.cs

How to try/catch all exceptions

回眸只為那壹抹淺笑 提交于 2019-12-10 18:26:09
问题 I'm completing a UWP app started by someone else. The app crashes frequently and I always end up in App.g.i.cs at if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break(); where I then have to say "no, don't start the debugger" and close 2 windows. Is there somewhere I could put a big try/catch so that I don't have to restart the app each time this happen? I can't find anything in AppShell or App . Or do I have to put a try/catch in every single event

Access C Drive files in UWP AppService

跟風遠走 提交于 2019-12-10 17:54:17
问题 How to access the system drive(C, D drive) files in UWP AppService. Example: I want to access "C:\Test\sample.txt" file from UWP AppServices. I have tried the below code. but throwing error(Additional information: Access is denied.). And also added the "Removable Storage" Capabalities in appxmanifest file. StorageFolder testfolder = await StorageFolder.GetFolderFromPathAsync(@"c:\\test"); StorageFile sourcefile = await testfolder.GetFileAsync("sample.txt"); StorageFile destinationfile = await

Binding a MapIcon in XAML

放肆的年华 提交于 2019-12-10 17:38:10
问题 I'm trying to use a MapControl, showing a MapIcon for the currently viewed location. In my XAML, I've got: <Maps:MapControl x:Name="MapControl" ZoomLevel="14" Center="{Binding Geopoint, Mode=OneWay}" Margin="-12,0,-12,0" Tapped="directions_Click" Height="200" MapServiceToken="{StaticResource BingMapsKey}" PanInteractionMode="Disabled" RotateInteractionMode="Disabled"> <Maps:MapIcon Location="{Binding Geopoint}" Title="{Binding AttractionName}" /> </Maps:MapControl> The items that I'm binding

Center placeholder text in TextBox

帅比萌擦擦* 提交于 2019-12-10 17:25:32
问题 I have multiple TextBoxes in my XAML-Page. <TextBox Name="TxtCompanyId" PlaceholderText="FirmaId" Height="40" Margin="5" TextAlignment="Center" /> The TextAlignment="Center" property only centers the text of the TextBox and not the placeholdertext/hint text. Is there a way to center both? 回答1: You can surely modify the defalut style and set PlaceholderTextContentPresenter's horizontal alignment to Center : <ContentControl x:Name="PlaceholderTextContentPresenter" Grid.ColumnSpan="2" Content="