uwp

Write to file in uwp that has been drag-dropped from explorer

旧街凉风 提交于 2020-07-09 05:55:24
问题 If file is dragged and dropped from file explorer it has FileAttributes.ReadOnly flag for StorageFile.Attributes parameter. In that case using StorageFile api to write to file will give error. How to write to file in this case?? 回答1: In this case PathIO api can be used to write to file (unless file is a system file). Convert data to write into bytes array and then add following code to write to file: await PathIO.WriteBytesAsync(file.Path, bytes); This will write to these files without any

UWP how to get access to file in folder

不打扰是莪最后的温柔 提交于 2020-07-06 02:38:09
问题 Help me please, I can't get access to file which I choose by FileOpenPicker. FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.Desktop; openPicker.CommitButtonText = "Открыть"; openPicker.FileTypeFilter.Add(".xlsx"); var file = await openPicker.PickSingleFileAsync(); using (FileStream fs = new FileStream(file.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { } What is wrong? 回答1:

UWP how to get access to file in folder

本小妞迷上赌 提交于 2020-07-06 02:37:10
问题 Help me please, I can't get access to file which I choose by FileOpenPicker. FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.Desktop; openPicker.CommitButtonText = "Открыть"; openPicker.FileTypeFilter.Add(".xlsx"); var file = await openPicker.PickSingleFileAsync(); using (FileStream fs = new FileStream(file.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { } What is wrong? 回答1:

Detect click on resize window UWP

我只是一个虾纸丫 提交于 2020-07-05 05:12:08
问题 I would like to launch a message dialog at the click of the resize button.. I inserted the message dialog in any click, but how can I launch it in the resize window? The code: public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } private async void Button_Click(object sender, RoutedEventArgs e) { var messageDialog = new MessageDialog("This is a Message dialog"); await messageDialog.ShowAsync(); } } I approached a possible solution but, I just need the

Detect click on resize window UWP

空扰寡人 提交于 2020-07-05 05:11:46
问题 I would like to launch a message dialog at the click of the resize button.. I inserted the message dialog in any click, but how can I launch it in the resize window? The code: public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } private async void Button_Click(object sender, RoutedEventArgs e) { var messageDialog = new MessageDialog("This is a Message dialog"); await messageDialog.ShowAsync(); } } I approached a possible solution but, I just need the

How to convert byte array to InMemoryRandomAccessStream or IRandomAccessStream in windows 8

别来无恙 提交于 2020-07-05 00:05:00
问题 now I've had a problem that is how to convert byte array to InMemoryRandomAccessStream or IRandomAccessStream in windows 8? This is my code, but It did't work, refer the following code internal static async Task<InMemoryRandomAccessStream> ConvertTo(byte[] arr) { InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream(); Stream stream = randomAccessStream.AsStream(); await stream.WriteAsync(arr, 0, arr.Length); await stream.FlushAsync(); return randomAccessStream; } And

How to convert byte array to InMemoryRandomAccessStream or IRandomAccessStream in windows 8

这一生的挚爱 提交于 2020-07-05 00:01:16
问题 now I've had a problem that is how to convert byte array to InMemoryRandomAccessStream or IRandomAccessStream in windows 8? This is my code, but It did't work, refer the following code internal static async Task<InMemoryRandomAccessStream> ConvertTo(byte[] arr) { InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream(); Stream stream = randomAccessStream.AsStream(); await stream.WriteAsync(arr, 0, arr.Length); await stream.FlushAsync(); return randomAccessStream; } And

Property changed is not updating the UI from inside a task

北慕城南 提交于 2020-07-04 04:19:28
问题 Firstly I have a user control which has a dependency property as follows. The MenuItems property is bound to some List control on the UI. public static readonly DependencyProperty MenuItemsProperty = DependencyProperty.Register( nameof(MenuItems), typeof(IEnumerable<MenuItem>), typeof(MenuViewControl), new PropertyMetadata(null)); public IEnumerable<MenuItem> MenuItems { get => (IEnumerable<MenuItem>)GetValue(MenuItemsProperty); set => SetValue(MenuItemsProperty, value); } The MenuItem class

Paragraph mark of UWP RichEditBox is not resized

六月ゝ 毕业季﹏ 提交于 2020-06-29 04:02:51
问题 With this code ( Editor.Document.Selection.CharacterFormat.Size = 20; ) I change the font size of a UWP RichEditBox in the Page_Loaded -handle. When I start typing some characters, everything works fine. But when I select the paragraph mark and then type something, this text appears in the wrong font size (10.5). What I've tried is to expand the selection before setting the font size, but it seems that there is no paragraph mark when there's no text. But when the rich edit box is empty and I

Paragraph mark of UWP RichEditBox is not resized

前提是你 提交于 2020-06-29 04:02:32
问题 With this code ( Editor.Document.Selection.CharacterFormat.Size = 20; ) I change the font size of a UWP RichEditBox in the Page_Loaded -handle. When I start typing some characters, everything works fine. But when I select the paragraph mark and then type something, this text appears in the wrong font size (10.5). What I've tried is to expand the selection before setting the font size, but it seems that there is no paragraph mark when there's no text. But when the rich edit box is empty and I