mergeddictionaries

Using BasedOn property with a Style defined in a different dictionary

走远了吗. 提交于 2019-12-04 10:45:59
The application I'm working on has 2 ResourceDictionary, DefaultStyles.xaml and CustomStyles.xaml. Is it possible that a style in the CustomStyles dictionary uses a base style defined in the other dictionary? DefaultStyles.xaml: <Style x:Key="TextBlockDefaultStyle" TargetType="TextBlock"> <Setter Property="Margin" Value="4" /> </Style> CustomStyles.xaml: <Style x:Key="SectionTitleStyle" TargetType="TextBlock" BasedOn="{StaticResource TextBlockDefaultStyle}"> <Setter Property="FontSize" Value="16" /> </Style> App.xaml: <Application.Resources> <ResourceDictionary> <ResourceDictionary

Referencing a resource in a ResourceDictionary from a different ResourceDictionary in Silverlight

半腔热情 提交于 2019-12-03 16:24:44
问题 I have the following set of code in my App.xaml: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Client.Common;component/Theme/Brushes.xaml"/> <ResourceDictionary Source="/Client.Common;component/Theme/Fonts.xaml"/> <ResourceDictionary Source="/Client.Common;component/Theme/CoreStyles.xaml"/> <ResourceDictionary Source="/Client.Common;component/Theme/SdkStyles.xaml"/> <ResourceDictionary Source="/Client.Common;component/Theme

Using MergedDictionaries in generic.xaml in Silverlight 3

穿精又带淫゛_ 提交于 2019-12-03 12:31:44
In WPF it was possible to organise the XAML for multiple user controls by keeping the markup in separate XAML files in the themes folder and then using MergedDictionaries to import them into generic.xaml: <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="MyFirstControl.xaml" /> <ResourceDictionary Source="MySecondControl.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> With the availability of the Silverlight 3 beta introducing merged dictionary support, it seemed like it might be possible to do the same with Silverlight user

Nested Resource Dictionary in separate library

谁都会走 提交于 2019-12-03 08:56:55
My question is very similar to this one I have a solution with a number of projects. The are two that are relevant: a class library that contains a WPF window and a project with all the WPF styles in it. Class Library with the window in Project 1 The Window's merged dictionary is something like: <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/StyleAssembly;component/CommonStyle.xaml"/> </ResourceDictionary.MergedDictionaries> //other styles here The CommonStyle.xaml in Project 2 : <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="

Merged dictionaries and local resources

依然范特西╮ 提交于 2019-12-01 00:14:22
问题 I have a Styles.xaml that groups many ResourceDictionary s inside a MergedDictionary . I imported Styles.xaml in my UserControl.Resources <UserControl.Resources> <ResourceDictionary Source="Dictionaries\Styles.xaml" /> </UserControl.Resources> but when I try to add a converter <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionaries\Styles.xaml" /> <--! Exception --> </ResourceDictionary.MergedDictionaries>

winrt xaml merged resources

馋奶兔 提交于 2019-11-30 23:46:59
I need to separate application styles to several xaml files. But I also need to define some shared values like <x:Double x:Key="SharedValue">100</x:Double> in single file for use this value in styles defined in other files. For instance: <Style x:Name="SomeStyle" TargetType="TextBox"> <Setter Property="Width" Value="{StaticResource SharedValue}"/> </Style> and in another resource dictionary file: <Style x:Name="AnotherStyle" TargetType="Button"> <Setter Property="Height" Value="{StaticResource SharedValue}"/> </Style> But when I try to define merged resource dictionary in App.xaml file

winrt xaml merged resources

你离开我真会死。 提交于 2019-11-30 18:04:33
问题 I need to separate application styles to several xaml files. But I also need to define some shared values like <x:Double x:Key="SharedValue">100</x:Double> in single file for use this value in styles defined in other files. For instance: <Style x:Name="SomeStyle" TargetType="TextBox"> <Setter Property="Width" Value="{StaticResource SharedValue}"/> </Style> and in another resource dictionary file: <Style x:Name="AnotherStyle" TargetType="Button"> <Setter Property="Height" Value="

WPF: Style based on another one in a separate assembly

浪子不回头ぞ 提交于 2019-11-30 08:26:01
Assembly A - ResourceDictionary contains StyleA style. Assembly B - ResourceDictionary.MergedDictionaries to merge resources from Assembly A into B. I would like to create a style in Assembly B "based on" StyleA. Is it possible? I am trying to create this style: <Style x:Key="StyleB" BasedOn="{StaticResource StyleA}"> <Setter Property="Button.Foreground" Value="Khaki"/> </Style> But I get a XamlParseException exception at run-time, if I use StyleB: Cannot convert the value in attribute 'Style' to object of type 'System.Windows.Style'. Can only base on a Style with target type that is base type

WPF: Style based on another one in a separate assembly

蓝咒 提交于 2019-11-29 11:14:44
问题 Assembly A - ResourceDictionary contains StyleA style. Assembly B - ResourceDictionary.MergedDictionaries to merge resources from Assembly A into B. I would like to create a style in Assembly B "based on" StyleA. Is it possible? I am trying to create this style: <Style x:Key="StyleB" BasedOn="{StaticResource StyleA}"> <Setter Property="Button.Foreground" Value="Khaki"/> </Style> But I get a XamlParseException exception at run-time, if I use StyleB: Cannot convert the value in attribute 'Style

MergedDictionaries and Resource lookup

痞子三分冷 提交于 2019-11-27 18:49:30
i have a problem with Resource dictionaries and mergeddictionaries in general, especially when it comes to resource-lookup performance. After some performance testing i found that ResourceDictionary.get_MergedDictionaries is the call with the most hits (checked in ANTS profiler). We have around ~300 resource dictionary xamls, and a lot of them are using merged dictionary to "include" other styles. Well the get_MergedDictionaries count on one part of our application, where not much is happening, was around 10 million hits. So my guess is we are doing something completely wrong with Resource