resourcedictionary

Using Styles in merged ResourceDictonaries in Silverlight 5

落爺英雄遲暮 提交于 2019-12-11 01:38:47
问题 I've got a bunch of styles in my app.xaml and they are all being used just fine in my pages within my SL5 app. I'd like to move these styles to multiple resource dictionaries to make it more manageable and consumable. First I copied a style to a new resource dictionary in the /Styles/ButtonStyles.xaml page in my project... a snippet looks like this: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

How to use ResourceDictionary in Windows Phone class library project

十年热恋 提交于 2019-12-11 01:28:30
问题 I have ResourceDictionary.xaml file in my Resources folder which has some style in it, i need to use this in my .cs file and xaml file as well how to use it? Here is my ResourceDictionary.xaml: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace

Xamarin.Forms - StaticResource in Shared Library

时间秒杀一切 提交于 2019-12-11 01:25:54
问题 I've made a Shared Library Project which defines some often used Views. For example: <Label x:Name="lblIcon" FontSize="30" Margin="20,0,5,0" WidthRequest="30" VerticalOptions="Center" /> Now to reuse that style, I defined that style inside App.Xaml (still inside the shared Project) and want to reference it via StaticResource: <Label x:Name="lblIcon" Style="{StaticResource TheLabelsStyle}" VerticalOptions="Center" /> But this throws an UnhandledException with no further information. Hopefully

How to style a XAML window with a ResourceDictionary that exist in a DLL?

ぐ巨炮叔叔 提交于 2019-12-11 00:58:27
问题 Hi I am trying to create a reusable XAML Window in a DLL. I have placed in the Themes folder a new ResourceDictionary (I even merged it in the Generic.xaml), but when I try to use its styles in the window, I get an error message that the style doesn't exist: <Window Style="{StaticResource ModalWindowStyle}" > <!-- I have also the following --> <Window.Resources> <Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}" /> </Window.Resources> </Window> I get an exception that this

Failed to assign to property 'Windows.UI.Xaml.Controls.ContentControl.Content'

无人久伴 提交于 2019-12-10 22:38:31
问题 In my windows 10 app I want to set button content from a resource file. In the designer the vector image from the resource file is visible. But in runtime the following exception occurs: An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in Demo.UI.W10.exe but was not handled in user code WinRT information: Failed to assign to property 'Windows.UI.Xaml.Controls.ContentControl.Content'. [Line: 15 Position: 17] Additional information: The text associated with this error

Trying to animate a SolidColorBrush static resource

烂漫一生 提交于 2019-12-10 18:42:18
问题 What I'd like I want to reuse some styles across multiple UserControl types. I would like the background of some Border controls to flash, and I'd like them all to use the same style, static resource and animation, so that they all flash in sync. How I'm trying to do it To that end, I have defined some common colours in a resource dictionary, like so: <SolidColorBrush x:Key="StatusErrorBackground" Color="#440000" /> ...and I have also defined a StoryBoard in this dictionary, like so:

How to reuse Storyboard with VisualStateManager In Silverlight 5

隐身守侯 提交于 2019-12-10 17:26:21
问题 This question has been asked before but in most cases no more recent than 2 years ago and often specific to WPF. The answer might still be there same, but here it goes. I'm trying to build a triangular (arrow) button that changes color and grows in size when the mouse is over it. I've got that working for a single button. But now I need buttons with the arrow pointing different directions. I want to reuse as much of the code as possible. Without using a custom button control, I couldn't think

WPF Windows 8 Compatibility Issue

ぐ巨炮叔叔 提交于 2019-12-10 13:55:35
问题 Given a button (or a combobox, or any control for that matter): <Button x:Name="button" Command="{Binding DoStuff}" Margin="10,0,5,5" Content="Do Stuff!" Style="{StaticResource buttonDefaults}"/> With the style: <Style x:Key="buttonDefaults" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> <Style.Resources> <ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/> </Style.Resources> <Setter Property="Background"> <Setter.Value>

Custom resource dictionary inside ControlTemplate or DataTemplate

强颜欢笑 提交于 2019-12-10 13:31:20
问题 EDIT: This problem occurs when using the standard .NET ResourceDictionary as well and appears to be an issue with using resource dictionaries inside control or data templates. I have a custom resource dictionary that follows a common approach to sharing resource instances. http://softnotes.wordpress.com/2011/04/05/shared-resourcedictionary-for-silverlight/ http://www.wpftutorial.net/MergedDictionaryPerformance.html public class SharedResourceDictionary : ResourceDictionary { static readonly

Window Startup Location from resource dictionary

孤街醉人 提交于 2019-12-10 10:34:49
问题 I'm trying to set all my windows to open in the center of the screen. All my windows use style file: <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../Styles/Mystyles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> So I just inserted this property to the resource dictionary: <Style x:Key="windowStyle" TargetType="Window"> <Setter Property="WindowStartupLocation" Value="CenterScreen"/> <