app.xaml

Set static resource in code

爷,独闯天下 提交于 2019-12-03 01:50:18
I have a few styles in my App.xaml file: <SolidColorBrush x:Key="styleBlue" Color="#FF4B77BE"/> <SolidColorBrush x:Key="styleRed" Color="#FFF64747"/> <SolidColorBrush x:Key="styleOrange" Color="#FFF89406"/> <SolidColorBrush x:Key="styleGreen" Color="#FF1BBC9B"/> <SolidColorBrush x:Key="styleYellow" Color="#FFF9BF3B"/> <Style x:Key="stackpanelBackground" TargetType="StackPanel"> <Setter Property="Background" Value="{StaticResource styleBlue}"/> </Style> I want to change the BackgroundProperty in the code of my mainpage.xaml.cs . I tried using this: Style style = Application.Current.Resources[

datatemplate in app.xaml is not getting picked up without any styles?

放肆的年华 提交于 2019-11-30 14:40:13
问题 I have a DataTemplate in app.xaml that binds a view to a viewmodel. <Application.Resources> <DataTemplate DataType="{x:Type vm:someviewmodeltype}"> <vw:somevwcontrol /> </DataTemplate> </Application.Resources> the above template doesn't get applied if there are no styles. The moment I put a style, something like ... <Application.Resources> <DataTemplate DataType="{x:Type vm:someviewmodeltype}"> <vw:somevwcontrol /> </DataTemplate> <Style TargetType="TextBlock"> <Setter Property="FontSize"

Dynamic PAth Icon Buttons in a Collection ItemTemplate Resource w/ MouseOver

孤街浪徒 提交于 2019-11-30 08:42:02
问题 I am working with icons.XAML images, inserting them into buttons above a text block. Everything looks great until I hover over the image itself. A gray box appears over the picture only: How do I get rid of the gray box? Here is one of the icons: <Canvas x:Key="appbar_cog" Width="38" Height="46" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0" Background="Transparent"> <Path Width="37.6263" Height="37.6262" Canvas.Left="15" Canvas.Top="5" Stretch="Fill" Fill="#FF5DBEBE" Data="F1 M 27.5314,21.8628L 33

Dynamic PAth Icon Buttons in a Collection ItemTemplate Resource w/ MouseOver

六眼飞鱼酱① 提交于 2019-11-29 07:33:25
I am working with icons.XAML images, inserting them into buttons above a text block. Everything looks great until I hover over the image itself. A gray box appears over the picture only: How do I get rid of the gray box? Here is one of the icons: <Canvas x:Key="appbar_cog" Width="38" Height="46" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0" Background="Transparent"> <Path Width="37.6263" Height="37.6262" Canvas.Left="15" Canvas.Top="5" Stretch="Fill" Fill="#FF5DBEBE" Data="F1 M 27.5314,21.8628L 33.0126,19.4224L 34.7616,23.3507C 36.6693,22.9269 38.6044,22.8903 40.4668,23.2026L 42.0083,19.1868L 47

WPF: Changing Resources (colors) from the App.xaml during runtime

家住魔仙堡 提交于 2019-11-27 03:30:00
问题 I am trying to make my application more customizable by allowing users to pick a color from a Color Picker dialog, and then changing the style of the application in real time (with DynamicResource ) How do I go about in changing specific resources that reside in the app.xaml ? I have tried something like this but no luck (just a test): var colorDialog = new CustomControls.ColorPickerDialog(); var dResult = colorDialog.ShowDialog(); var x = Application.Current.Resources.Values.OfType