resourcedictionary

How to Use This StackPanel as a Resource

旧街凉风 提交于 2019-12-12 16:26:09
问题 I am just trying to get the StackPanel content into a ResourceDictionary. I tried wrapping it into a data tempplate but no go. Some other sort of template? A style? How can I extract this to a resource and then use the content in my view's grid layout? Cheers, Berryl the xaml to move <StackPanel x:Name="_filterByTypeOptions" Orientation="Horizontal" Margin="5, 5" > <RadioButton Style="{StaticResource FilterPanelRadioButtonStyle}" IsChecked="{Binding ShowAllContacts, Mode=TwoWay}" Content="

How to properly change a resource dictionary

做~自己de王妃 提交于 2019-12-12 15:44:30
问题 I am working on localizing a GUI in WPF. The code that I post here will be from a prototype because I am trying to make this question as simple as possible. I am using Resource Dictionaries to set the content of the strings in my window. I have two of them, one is German, and the other is English. German Resource Dictionary: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace

Separate ResourceDictionary for each project type

余生颓废 提交于 2019-12-12 15:28:32
问题 I've created a ResourceDictionary in my Shared project without problem. However, some of my styles will be very particular* to Windows Phone 8.1 and not used in Windows 8.1. As there's no App.xaml in the Windows Phone project, how do I specify a ResourceDictionary just for Windows Phone? *In addition to different sizes and margins, extensive use of PhoneAccentBrush which is obviously not available on Windows Store Apps. Or, if the Shared ResourceDictionary is the preferred method, how do I

Why am I being told a class does not exist in my namespace when it does?

自闭症网瘾萝莉.ら 提交于 2019-12-12 05:57:51
问题 I am trying to follow the article here to add a custom control to my project so that I can call it ("promptForPhotosetName") like so: Popup popTart = new Popup(); popTart.Child = new promptForPhotosetName(); popTart.IsOpen = true; I added a Custom Control to my project based on Templated Control. My custom control class (which IS in the Photrax namespace) contains this constructor: public promptForPhotosetName() { this.DefaultStyleKey = typeof(promptForPhotosetName); } I have this in \Themes

How to use a style several times in a resourcedictionary from an external resourcedictionary?

余生长醉 提交于 2019-12-12 05:36:31
问题 I have a style for button inside a resourcedictionary, and now I want to use this style in another resource several times(for several buttons), but it just effects on the last button. What's the problem here? Edit: this is my style:(CommonControlStyles.xaml) <ResourceDictionary .....> . . . <Style TargetType="{x:Type Button}" x:Key="ListButtonsStyle"> <Setter Property="MaxHeight" Value="35"/> <Setter Property="Width" Value="20"/> <Setter Property="Content"> <Setter.Value> <Image Source=

Cannot instantiate UserControl from another assembly - Resource cannot be found

吃可爱长大的小学妹 提交于 2019-12-12 02:26:27
问题 I have a solution with two WPF projects: Primary and Secondary. In the Primary project, a Window named PrimaryView instantiates an UserControl called SecondaryControl, defined in Secondary project. SecondaryControl uses SecondaryStyle, which is defined in SecondaryResourceDictionary (as you might have guessed already, defined in SecondaryProject). The fact is: when I try to run the solution, I get a XamlParseError , and digging InnerExceptions I eventually find the culprit, the

Changing SolidColorBrush#Color in resource dictionary failed: Property is readonly [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 01:37:28
问题 This question already has an answer here : Binding SolidColorBrush to ControlTemplate Background (1 answer) Closed 3 years ago . I have a SolidColorBrush resource in the App.xaml like this: <SolidColorBrush Color="#73AF00" x:Key="BaseGreen"></SolidColorBrush> All my styles(buttons, grid backgroun color, etc, etc) contains that resource and i want that when the user change the color settings, the whole app color will be change to blue. var color = System.Windows.Application.Current.Resources[

How to set attributes without overriding the Mahapps theme?

拜拜、爱过 提交于 2019-12-12 00:27:10
问题 I'm using Mahapps for a GUI, however I want to set some attributes different than visual ones such as margins and verticalAlignment , so I added this to the UserControl.resources section <Style x:Key="{x:Type TextBox}" TargetType="TextBox" BasedOn="{StaticResource ResourceKey={x:Type TextBox}}"> <Setter Property="Margin" Value="2"/> <Setter Property="VerticalAlignment" Value="Center"/> </Style> However it overrides all the visual styles attributes of the TextBoxes, how can I just add those

Let the user change the resource dictionnary

我的未来我决定 提交于 2019-12-11 22:11:19
问题 All my styles and templates are located in a resource dictionnary named "design.xaml" so in every Usercontrol I have : <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/MyProject;component/design.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> But I'd like to let the user choose his preferred design by creating 2 resources dictionnaries with the same templates inside (same key for

How to handle events from ResourceDictionary without using ResourceDictionary Code-Behind?

会有一股神秘感。 提交于 2019-12-11 18:13:42
问题 I would like help regarding how to handle events from controls in a ResourceDictionary (e.g. Styles.xaml) without using ResourceDictionary Code-Behind (e.g. Styles.xaml.cs), mainly because I want the Styles.xaml to just be there for styling. My scenario is, I have a Custom Page which uses a ResourceDictionary for DataTemplate styles (I am using a TemplateSelector). However, the problem I am currently having is for handling events. For example: I have this in my Styles.xaml : . . <Button Click