wpf-style

Wpf Font Style Not Working in RunTime and don't show correct view of my font in Design Time

痴心易碎 提交于 2019-12-25 01:46:57
问题 I using a separate project for my styles a and i have some line of codes like this in it: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Style x:Key="NazaninFont" TargetType="Control"> <Setter Property="FontFamily" Value="pack://application:,,,/Extra/Fonts/#IRNazanin"/> </Style> ...... </ResourceDictionary> My another styles (like control effects and...) work well when i use my style key in the

WPF TextBox Border Style Trigger IsFocused only works if has focus but not keyboard focus

北慕城南 提交于 2019-12-23 03:12:16
问题 I would like a nice little orange border around my Textbox whilst the user is typing in it (Has Focus). I defined styles for the tiggers I think I need, but there is a strange behavior. When the cursor is in the TextBox and the WPF app has focus, it has a blue border. But while the cursor is focused and I click outside of the app (like in visual studio) it becomes orange. I've tried overriding many triggers but to no avail. This is what happens when I focus on the textbox but am focused on

Finding the default style for a type in code behind

倖福魔咒の 提交于 2019-12-18 20:09:23
问题 In WPF, you can create a Style that acts as the default for a control type in XAML: <Style TargetType="{x:Type local:MyControl}"> . . . </Style> Then, when WPF goes to display that control, it looks up that Style from the resources based on the its type. I want to do the equivalent of this in the code-behind of my program. How do I find that Style ? 回答1: You can search for the style in the Application-level resources by using the control type as the key: Style defaultStyle = Application

Error: 'Cannot create unknown type '{clr-namespace:NameSpace.Properties}Settings'.'

旧巷老猫 提交于 2019-12-17 18:25:58
问题 I define my settings and styles in a ResourceDictionary: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:properties="clr-namespace:Kavand.UI.Properties"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary> <properties:Settings x:Key="settings" /> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> <Style x:Key="PopupMenu_StackPanel"> <Setter Property="TextBlock.FontSize"

wpf toolkit datetimepicker how to change color of spinner

给你一囗甜甜゛ 提交于 2019-12-12 04:05:42
问题 How can I change the color of the spinner-arrows for the DateTimePicker from xceed WPF Toolkit? I cant find a Property where the set the color for the arrows. Do i need to override the whole ButtonSpinner to do so? If yes how can I do that, I still a beginner at WPF and if I simply try to copy the sourcecode from the ButtonSpinner reference page Visual Studio complains that the term "ResourceKeys does not exist in the namespace" of themes 回答1: I have written spinner button style as follows

CellStyle based on RowStyle in WPF

纵饮孤独 提交于 2019-12-07 06:05:10
问题 I have a WPF DataGrid represented in XAML . I'm using a RowStyle for my grid's TableView but also need to set some properties for specific cells. I need those cells to have the properties of the row style and apply the extra properties from the cell style on top of those. What I would need is something like this, although this doesn't work as it's saying: Target type 'CellContentPresenter' is not convertible to base type 'GridRowContent' <Style x:Key="MyGridRowStyle" BasedOn="{StaticResource

Inherited WPF Style with triggers doesn't work

房东的猫 提交于 2019-12-07 05:16:28
问题 I have a style that fades out a control with animation: <Style x:Key="ExpireFadeStyle"> <Style.Resources> <!--Change this in a derived style if required--> <sys:Double x:Key="FinalVal">0.25</sys:Double> </Style.Resources> <Style.Triggers> <DataTrigger Binding="{Binding IsExpired}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard x:Name="ExpireAnimation"> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="{StaticResource FinalVal}" Duration="0:0:3" /> <

C# WPF Textblock different font color per line

拈花ヽ惹草 提交于 2019-12-06 07:43:36
I am trying to make each line of text on a WPF textblock display in a different color. I have the following code which makes the entire block's font color purple because that's the last color it's set to. How can I make it so each potion is displayed in a different color? private void btnShowPotions_Click(object sender, RoutedEventArgs e) { tbPotionInfo.Foreground = Brushes.Green; tbPotionInfo.Text = smallPotion.Name + "(" + smallPotion.AffectValue + ")\r\n"; tbPotionInfo.Foreground = Brushes.Blue; tbPotionInfo.Text += mediumPotion.Name + "(" + mediumPotion.AffectValue + ")\r\n"; tbPotionInfo

CellStyle based on RowStyle in WPF

做~自己de王妃 提交于 2019-12-05 11:31:02
I have a WPF DataGrid represented in XAML . I'm using a RowStyle for my grid's TableView but also need to set some properties for specific cells. I need those cells to have the properties of the row style and apply the extra properties from the cell style on top of those. What I would need is something like this, although this doesn't work as it's saying: Target type 'CellContentPresenter' is not convertible to base type 'GridRowContent' <Style x:Key="MyGridRowStyle" BasedOn="{StaticResource {themes:GridRowThemeKey ResourceKey=RowStyle}}" TargetType="{x:Type dxg:GridRowContent}"> <Setter

Reset inherited WPF style?

老子叫甜甜 提交于 2019-11-30 20:58:08
In the App.xaml portion of my application I have a ResourceDictionary element that targets things like DataGridColumnHeader and DataGridCell and applies custom styling to them. These definitions are global (in that they don't use a x:key - they apply to all instances of the type). Is it possible to completely reset the style of these types to the 'base' Aero theme (or whatever theme is currently in use) for use in a subsection of my application? I've tried using <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> </Style> Which doesn't