uwp-xaml

The TargetType for Line in style doesn't work in UWP

拟墨画扇 提交于 2021-02-11 13:38:11
问题 I have the following code: <Grid> <Grid.Resources> <Style TargetType="Line"> <Setter Property="Stroke" Value="Black"></Setter> <Setter Property="StrokeDashArray" Value="3"></Setter> <Setter Property="StrokeThickness" Value="3"></Setter> </Style> </Grid.Resources> <Line X1="20" X2="500" Y1="50" Y2="50"></Line> <Line X1="20" X2="500" Y1="100" Y2="100"></Line> <Line X1="20" X2="500" Y1="150" Y2="150"></Line> </Grid> You could see the screenshoot, the StrokeDashArray property value in the style

Binding DataTemplate's datacontext property to a usercontrol dependency property

这一生的挚爱 提交于 2021-02-11 08:09:18
问题 In a UWP application, i have a Listview with a datatemplate. The ListView is binded via ItemsSource to an ObservableCollection of my model. <ListView SelectionMode="None" ItemTemplate="{StaticResource MydataTemplate}" ItemsSource="{Binding Meals, Mode=OneWay}" Meals is the ObservableCollection of model Meal : public class Meal { public string restaurantId { get; set; } public double price { get; set; } public int Quantity { get; set; } = 0; } Inside ListView DataTemplate, i have a User

Binding DataTemplate's datacontext property to a usercontrol dependency property

扶醉桌前 提交于 2021-02-11 08:07:14
问题 In a UWP application, i have a Listview with a datatemplate. The ListView is binded via ItemsSource to an ObservableCollection of my model. <ListView SelectionMode="None" ItemTemplate="{StaticResource MydataTemplate}" ItemsSource="{Binding Meals, Mode=OneWay}" Meals is the ObservableCollection of model Meal : public class Meal { public string restaurantId { get; set; } public double price { get; set; } public int Quantity { get; set; } = 0; } Inside ListView DataTemplate, i have a User

Display local html file content in UWP WebView

﹥>﹥吖頭↗ 提交于 2021-02-07 12:43:08
问题 I believe this is pretty straightforward task and I've seen a lot of examples in the web but still none of them is working for me since I experience different exceptions. html: <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <p> Help html content. </p> </body> </html> xaml: <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="30"/> </Grid.RowDefinitions> <WebView x:Name="webView" /> <Button x:Name="buttonRefresh" Grid.Row="1" HorizontalAlignment

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

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

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

Why is the form / page in my UWP app truncated at run time (doesn't reflect design time size)?

ε祈祈猫儿з 提交于 2021-01-29 08:29:16
问题 At design time in my UWP app, I've left enough room for everything I want (six buttons across the top and a TextBlock which will ultimately contain more text): Note too, the textBlocks at the bottom of the page. At runtime, the top TextBlock is terribly truncated, and all of the TextBlocks at the bottom of the form/page don't display at all, presumably for the same reason: If this is working as designed (by Microsoft, that is, not by me), what do I need to do to fall in line with the accepted

Drawing image using Blur effects in UWP is not properly set size for the image

风格不统一 提交于 2021-01-29 08:20:51
问题 I want to blur the image using slider. For this, I have used Win2D Blur effects and draw the image in CanvasControl and added the canvas over the actual image. Download sample here Steps. 1. Added CanvasControl in button click. It will add a child to grid over the actual element 2. Change Slider to apply the blur 3. Issue: Image stretched and it's size too large and look like cropped. Not in the given size (500, 400) [XAML] <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="7*"/>

Disabled color of NumBox header

你。 提交于 2021-01-29 05:22:05
问题 As NumBox seems to have a bug of not dimming the label when the control is disabled (other controls do, of course), I try to style it to force this behavior: <Style TargetType="ux:NumberBox"> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <TextBlock x:Name="HeaderText" Text="{Binding}" Foreground="{ThemeResource TextControlHeaderForeground}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="VisualStateGroup"> <VisualState x:Name="Disabled"> <VisualState