uwp

Multiple ViewModels in same View

非 Y 不嫁゛ 提交于 2021-01-29 22:05:19
问题 I have several different ViewModels that I would like to display in the same view (MainPage.xaml). I'm new to this and don't know how to do it. I have tried to create a MainViewModel: public class MainViewModel : ViewModelBase, INotifyPropertyChanged { WeatherViewModel weatherView = new WeatherViewModel(); ForecastViewModel forecastViewModel = new ForecastViewModel(); DeparturesViewModel departuresViewModel = new DeparturesViewModel(); CalenderViewModel calenderViewModel = new

How to disconnect print event handler in uwp printing?

a 夏天 提交于 2021-01-29 21:52:21
问题 I need to print a single xaml-page within a multiple page UWP-app. I only get as far as printing this page, but when leaving that page and trying to navigate back to it the following exception is thrown: For the PrintTaskRequested-event only one handler at a time can be registered (translated). The MS-instruction says that you have to disconnect the printing event handlers when you leave the printing page. Strange enough I found 2 short and understandable uwp-printing examples here on

Missing icon in Segoe MDL2 Assets font family

[亡魂溺海] 提交于 2021-01-29 19:00:44
问题 I'm trying to create an AppBarButton where the icon property is a FontIcon but the specific icon I want to use is not working; it is showing as a rectangle. I'm creating a UWP app in C# and I'm trying to create a button with the QR Code (Unicode point ED14) icon from the Segoe MDL2 Assets font but when I enter the icon identifier into the Glyph property of the FontIcon element it simply shows the placeholder rectangle as if the font is not installed. Every other icon I have used in my app

Shortcut for theme styling in XAML / UWP

好久不见. 提交于 2021-01-29 18:48:24
问题 Hopefully this isn't a stupid question but I've spent several hours looking for this answer with no results. Basically, I want to be able to control the appearance of hovered and pressed buttons. I've included the code for one of my buttons below. Here are my issues I have other buttons in my UI that I want to be able to assign this same style to I'd rather not copy/paste all this code because if I ever need to change the colors later, I'm screwed The <style> tag doesn't work because it can't

Convert BitmapImage to SoftwareBitmap in UWP

◇◆丶佛笑我妖孽 提交于 2021-01-29 17:43:17
问题 I need to find out how to convert a BitmapImage object into a SoftwareBitmap in order to save it to a file without losing resolution as I would do with RenderTargetBitmap. I have the following situation: private void TakePic() { BitmapImage currentImage = new BitmapImage(new Uri("http://.../image.jpg")); ImageControl.Source = currentImage; } private void SavePic() { StorageFile file = await folder.CreateFileAsync(...); using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode

write string to textblock on different page in C#, UWP

送分小仙女□ 提交于 2021-01-29 13:30:17
问题 How can I write into a TextBlock on a different page? So far it only works with TextBlocks on the same page. The async function is in Page_1 . The TextBlock is on Page_2 . public async void Serial() { string rxBuffer; //code //code //code while (true) { textblock_DebugRx_Gas_live.Text = rxBuffer; } } 回答1: write string to textblock on different page in C#, UWP If the two page display in foreground at same time like following. <Grid> <Grid.RowDefinitions> <RowDefinition Height="1*"/>

Sync settings and update changes across all instances in multiple instance uwp app

荒凉一梦 提交于 2021-01-29 13:28:45
问题 I am designing an uwp app with multiple instances, I want to sync settings across all instances so that when I change a setting in one instance all the instances produce the same effect. How do I go about this?? 回答1: Create an out-of-proc appservice as explained in this article, disable multiinstance for appservice. In the appservice code along with storing the created appservice connection store a static list of all the appservice created by all the new app instance. Whenever settings is

AutoSuggestBox sugestion lists not closing during scroll in UWP

混江龙づ霸主 提交于 2021-01-29 12:42:05
问题 AutoSuggestBox suggestion list aren't closing during scroll which causes weird UI issue. The issue will look like the one below, which i have taken from the default XAML Controls Gallery application. A simple AutoSuggestBox i have tested <AutoSuggestBox TextChanged="AutoSuggestBox_TextChanged" Width="300" /> Is there a better way to fix this other than using ScrollViewer.ViewChanged 回答1: AutoSuggestBox sugestion lists not closing during scroll in UWP We could not set the Popup

UWP TabView scroll button

懵懂的女人 提交于 2021-01-29 12:02:53
问题 I find out that the tabs of TabView can be scrolled when there is an overflow. And I can scroll them using the buttons I circled out in the image I posted above. However, I can't find out how to modify them. I just want to set their BorderThickness to 0. Can someone point them out in the source style of my TabView ? 回答1: The RepeatButton in your PlaylistTabView.xaml represents the style of the Button which you circled out, so you can set the BorderThickness to 0 in it. Note that there are two

Which event happens when I touch the thumb of the slider?

蹲街弑〆低调 提交于 2021-01-29 11:14:15
问题 I'm customize a slider to making seeking bar for video. What I want is that when I touch the thumb the video stops. Then I can drag the thumb and display the video corresponding to the slider's value. This is my Slider in XAML <Slider Style="{StaticResource SliderStyle1}" Grid.Column="1" x:Name="volumeSlider" Width="Auto" VerticalAlignment="Center" ValueChanged="volumeSlider_ValueChanged" DragLeave="volumeSlider_DragLeave" DragEnter="volumeSlider_DragEnter" DragStarting="volumeSlider