resourcedictionary

WPF performance impact ResourceDictionary merging vs updating

被刻印的时光 ゝ 提交于 2019-12-11 16:16:13
问题 I have to update font size dynamically in WPF app. Performance wise which is a better approach or what are pros & cons of below 2 approaches? Merging dictionary [see API OnFontSizeChanged_MergeDictionary] Updating Resource Key [see API OnFontSizeChanged_UpdateResourceKey] I have defined all used FontSizes in GenericResourceDictionary.xaml: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System=

Style DataGridColumnHeader with Styles in WPF

不问归期 提交于 2019-12-11 15:24:56
问题 Hi i am trying to implement a way to filter my records in a DataGrid. My idea is to put TextBoxes in the Header of each Column. I am doing this depending if a ToggleButton is pressed or not, but i am having a problem in the way that i am applying the style in the Header. If i apply the style inside the DataGridColumn like this: <DataGridTextColumn> <DataGridTextColumn.HeaderTemplate> <DataTemplate> (...) </DataTemplate> </DataGridTextColumn.HeaderTemplate> </DataGridTextColumn> It will work

Re-using UI in WPF from a Resource

穿精又带淫゛_ 提交于 2019-12-11 12:59:14
问题 I have a several tabs on UI where on each tab I need the below: <StackPanel Orientation="Horizontal"> <Button Content="<" Command="{Binding MoveToPreviousCommand}" /> <TextBlock Text="{Binding SelectedItem.Name}" /> <Button Content=">" Command="{Binding MoveToNextCommand}" /> </StackPanel> Is there a way to avoid replicating this code in XAML for each tab by specifying the above for example in the Resources only once and pointing into that resource under each tab? 回答1: Using ContentControl

Control event not firing from class linked to resource dictionary wpf

百般思念 提交于 2019-12-11 08:20:42
问题 Hi I am attempting to attach a function to text box used for entering some input information which is loaded to an interface from resource dictionary. Here is the XML, <ContentControl> <Grid> <Image s:DesignerItem.Code ="1773" IsHitTestVisible="False" Stretch="Fill" Source="../Images/addition.png" ToolTip="Addition" /> <TextBox Height="57" Width="56" Margin="13,13,130,13" BorderThickness="0" FontSize="45" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment=

Storyboards in ResourceDictionary

帅比萌擦擦* 提交于 2019-12-11 08:10:00
问题 So I would like to move my Storyboards into a ResourceDictionary file and I am having trouble doing that. I have looked everywhere and it involves making the "Resource" sharable but how do I do that in silverlight when there is no x:Shared attribute. Here is the code <Storyboard x:Key="GreenButtonLight" > <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GreenBelow" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">

How to bind string of class to resource dictionary

蹲街弑〆低调 提交于 2019-12-11 07:58:12
问题 I have many tooltips saved in file hints.xaml . Like this : <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApp7.Theme" x:Class="WpfApp7.Theme.Hints"> <ToolTip x:Key="myToolTip" > <StackPanel > <Label Content="Nadpis" /> <TextBlock Text="................"/> </StackPanel> </ToolTip> </ResourceDictionary> How i can bind string of class Enviroment.CurrentDictionary on my

C# Silverlight - When do Resource Dictionaries get created?

隐身守侯 提交于 2019-12-11 07:33:46
问题 I am working on a Silverlight 4 project where I get a memory leak because every time some xaml views are loaded they create their own instance of a class that then gets hooked with event triggers and don't get garbage collected. Removing the event listeners has proved too tricky under the circumstances for me to handle it that way. So Instead I want the instance of the class to be re-used every time the xaml view loads. To do this I was planning on adding a Resource Dictionary to each project

Access variable in code-behind from Resources in UserControl

江枫思渺然 提交于 2019-12-11 04:27:42
问题 I have the following problem: I want to access one of these three vars, defined in XAML Resource <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../../Themes/MainStyle.xaml" /> </ResourceDictionary.MergedDictionaries> <System:Int32 x:Key="maxVal">500</System:Int32> <System:Int32 x:Key="minVal">250</System:Int32> <System:Int32 x:Key="actualWidth">250</System:Int32> </ResourceDictionary> </UserControl.Resources> I want to access

Avalon Wizard Resource not found during debugging in Visual Studio 2015

荒凉一梦 提交于 2019-12-11 03:58:36
问题 in my project I am trying to use the Avalon Wizard component. I can build and execute my program without problems but I am not able to run it inside Visual Studio 2015 in debugging mode. It claims that the resource "avalonwizard;v1.2.0.0;themes/avalonwizard;component/themes/aerowizardheader.xaml" cannot be found. I installed Avalon Wizard using Nuget (but it also fails if I add the assembly manually to my project). I used the newest version of Avalon Wiszard (1.2.0.0). It makes no difference

Visual Studio 2015 XAML Resource Dictionary Error

女生的网名这么多〃 提交于 2019-12-11 03:54:33
问题 PART 1 (solved) The following XAML works fine in Visual Studio 2013 (Premium, Update 5): <Window.Resources> <ResourceDictionary Source="Resources/Dictionaries/Main.xaml" /> </Window.Resources> However, when working with the same project in Visual Studio 2015 (Enterprise), it complains with the following error: Exception: An error occurred while finding the resource dictionary "Resources/Dictionaries/Main.xaml". A different topic concerns a similar error with Visual Studio 2012, and was