resourcedictionary

ResourceDictionary Source Binding to Module (for Localization)

柔情痞子 提交于 2019-12-10 10:19:26
问题 I have a XAML Window that has a set of strings that are bound to objects like so: <Label Content="{StaticResource LabelUserName}" HorizontalAlignment="Right" Name="Label1" VerticalAlignment="Center" /> This code works fine when I define my ResouceDictionary like this: <Window.Resources> <ResourceDictionary > <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Strings/Strings_en-US.xaml" /> </ResourceDictionary.MergedDictionaries> <ObjectDataProvider x:Key="objLogon"

How get Brushes from Resource Dictionary and apply it to an element dynamicallly in wpf?

淺唱寂寞╮ 提交于 2019-12-10 02:50:03
问题 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <LinearGradientBrush x:Key="ButtonNormalBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#C10099FF" Offset="0"/> <GradientStop Color="#C16699CC" Offset="1"/> <GradientStop Color="#C1006699" Offset="0.49"/> <

Set Style for user control

 ̄綄美尐妖づ 提交于 2019-12-09 19:00:42
问题 I am trying to set a style for my user control. The UserControl is in a project "Controls" and the theme is in a project "MainProject" <UserControl x:Class="Controls.OutputPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="OutputControl"> <!-- Style="

Why are absolute uri's required for merged dictionaries in Generic.xaml?

落爺英雄遲暮 提交于 2019-12-09 15:12:08
问题 Consider a File | New Project of a WPF Application that contains: A new custom control named CustomControl1 Two new resource dictionaries named Dictionary1 and Dictionary2 Take the generated style out of Generic.xaml and move it to Dictionary2. Then merge Dictionary2 into Dictionary1 and Dictionary1 into Generic like this: <!--Generic.xaml--> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/Themes/Dictionary1.xaml"/> </ResourceDictionary

pack://application:,,,/ResourceFile.xaml Never Works

ⅰ亾dé卋堺 提交于 2019-12-09 11:48:02
问题 I have never been able to get this format of reference a Resource Dictionary to work. What am I missing. Scenario: Creating and assembly with some usercontrols in it. At root have said file {root}/Themes/ColorThemes.xaml The ColorThemes.xaml file has its build action set to Resource. Then in in xaml file further down let say {root}/Controls/ButtonStyles/Themes/ButtonThemes.xaml (note the path is just an example) in this file I have the following bit of code: <ResourceDictionary

WPF executable won't run outside of Visual Studio (resource dictionary issue)

孤街浪徒 提交于 2019-12-08 18:41:48
问题 I have a WPF app that works beautifully if I "debug" (F5) in Visual Studio (Debug and Release mode both work), but if I try to double-click the .exe in the bin\Release folder, Windows kills the application immediately. The problem appears to be that the executable can't find "PresentationFramework.Aero", which I added to my App's resource dictionaries as follows: <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor

Proper usage of Merged Resource Dictionaries in Silverlight 3

痴心易碎 提交于 2019-12-08 17:36:30
问题 As I read: http://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx, specifically the section labeled "Forward References With a ResourceDictionary": Static resource references from within any given resource dictionary must reference a resource that has already been defined lexically before the resource reference. Forward references cannot be resolved by a static resource reference. For this reason, if you use static resource references, you must design your resource dictionary structure

Can you define a ResourceDictionary.MergedDictionary together with other (local) resources in <Windows.Resources>?

血红的双手。 提交于 2019-12-08 15:00:55
问题 I would like to refer to a MergedDictionary together with locally declared resources in my Windows.Resources. However, I'm getting this error: "All objects added to an IDictionary must have a Key attribute or some other type of key associated with them." Is it possible to mix local resources together with imported resources in the same Window.Resources? The XAML is: <Window.Resources> <CollectionViewSource x:Key="cvsData" Source="{Binding Path=Data}"> <CollectionViewSource.GroupDescriptions>

Using a resource and DataTemplateSelector from a different assembly

微笑、不失礼 提交于 2019-12-08 13:05:43
问题 I have a control in a base assembly with Content that I would like to set based on the current DataContext. To do so, I am trying to use a resource and subclassed DataTemplateSelector in the calling assembly as shown below. My initial hope was that the sub classed DataTemplateSelector would be called, but it isn't. Then I tried adding an entry in the Resource Dictionary of the calling assembly with the same key but the sub classed selector, but that doesn't get it done either. Is there a way

Blend in visual studio 2012: Missing the “resources” window i used to use in blend 4

守給你的承諾、 提交于 2019-12-08 06:15:42
问题 In blend 4 i often open a resource dictionary (i.e. "Generic.xaml") by clicking the "resources" tab (next to the property tab on the right pane), navigate to a resource and click on its icon to edit it in the designer. In blend for visual studio 2012 i can't seem to find the resources tab? How am i then able to edit resources in resource dictionaries? 回答1: I'm assuming this is a XAML project. Is the Window open? Main toolbar -> Window -> Resources... is that checked? If not, check that. 回答2: