styles

How to implement event triggered WPF control style change

一个人想着一个人 提交于 2020-01-06 08:52:46
问题 I have an style template for my Button control that looks like that: <Style x:Key="myBtnStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="border" Width="100" Height="25" Padding="5,5,5,5" CornerRadius="5,5,5,5" Background="LightGray" BorderBrush="Black" BorderThickness="1,1,1,1"> <ContentPresenter x:Name="cpButton" VerticalAlignment="Center" HorizontalAlignment="Center" Width="Auto" Height="Auto"

How to implement event triggered WPF control style change

烂漫一生 提交于 2020-01-06 08:52:09
问题 I have an style template for my Button control that looks like that: <Style x:Key="myBtnStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="border" Width="100" Height="25" Padding="5,5,5,5" CornerRadius="5,5,5,5" Background="LightGray" BorderBrush="Black" BorderThickness="1,1,1,1"> <ContentPresenter x:Name="cpButton" VerticalAlignment="Center" HorizontalAlignment="Center" Width="Auto" Height="Auto"

How to change background of DataGridCell when IsEditing=True in WPF

非 Y 不嫁゛ 提交于 2020-01-05 18:56:26
问题 Setting background works fine for DataGridCheckBoxColumn but not for DataGridTextColumn . I set it for cell in resources: <Style TargetType="{x:Type DataGridCell}"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="#ffff00" /> </Trigger> <Trigger Property="IsEditing" Value="True"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderBrush" Value="#00ff00" /> <Setter Property="Background" Value="#00ff00" /> </Trigger> </Style

Applying style to elements inside a DataTemplate

拟墨画扇 提交于 2020-01-05 11:08:10
问题 I have a UserControl which simply contains a TextBlock and TextBox inside a DataTemplate. This is done in the following way: <UserControl.Resources> <DataTemplate DataType="{x:Type Binding:StringBindingData}" x:Key="dataTemp"> <StackPanel Orientation="Horizontal" Name="sPanel"> <TextBlock Name="txtDescription" Text="{Binding Description}" /> <TextBox Name="textboxValue" Text="{Binding Mode=TwoWay, Path=Value, UpdateSourceTrigger=PropertyChanged}" /> </StackPanel> </DataTemplate> </UserControl

Applying style to elements inside a DataTemplate

时光总嘲笑我的痴心妄想 提交于 2020-01-05 11:08:09
问题 I have a UserControl which simply contains a TextBlock and TextBox inside a DataTemplate. This is done in the following way: <UserControl.Resources> <DataTemplate DataType="{x:Type Binding:StringBindingData}" x:Key="dataTemp"> <StackPanel Orientation="Horizontal" Name="sPanel"> <TextBlock Name="txtDescription" Text="{Binding Description}" /> <TextBox Name="textboxValue" Text="{Binding Mode=TwoWay, Path=Value, UpdateSourceTrigger=PropertyChanged}" /> </StackPanel> </DataTemplate> </UserControl

In WPF Style, How can I change defined color?

有些话、适合烂在心里 提交于 2020-01-05 10:07:32
问题 I am making Image/Text button. When mouse over event arised, I want to change color of my drawing brush. How can I this? In below example, I want to iconBrush's color, Red -> Blue when mouse over. <SolidColorBrush x:Key="iconBrush" Color="Red"/> <DrawingBrush x:Key="buttonIcon" Stretch="Uniform"> <DrawingBrush.Drawing> <DrawingGroup> <DrawingGroup.Children> <GeometryDrawing Brush="{StaticResource iconBrush}" Geometry="... /> </DrawingGroup.Children> </DrawingGroup> </DrawingBrush.Drawing> <

Override CSS Display property with Flexslider 2

穿精又带淫゛_ 提交于 2020-01-05 07:45:06
问题 I am willing to hide in the carousel div div#carousel_container - in my case - of this Flexslider 2.2 slider all <li> of a certain class but the first one . The way I'm planning to do it is to hide them all (display:none) and then use jQuery to display (display:block) the first <li> which can be identified with the following custom attribute data-gal-order = 1 . I have tried several ways: Add div#carousel_container .slides li {display:none;} in my stylesheet and then use jQuery to change only

Override CSS Display property with Flexslider 2

本小妞迷上赌 提交于 2020-01-05 07:45:02
问题 I am willing to hide in the carousel div div#carousel_container - in my case - of this Flexslider 2.2 slider all <li> of a certain class but the first one . The way I'm planning to do it is to hide them all (display:none) and then use jQuery to display (display:block) the first <li> which can be identified with the following custom attribute data-gal-order = 1 . I have tried several ways: Add div#carousel_container .slides li {display:none;} in my stylesheet and then use jQuery to change only

WPF ComboBox: How to you utilise a generic ItemContainerStyle with binding

佐手、 提交于 2020-01-05 07:22:18
问题 I want to utilise a generic style for my ComboBoxItem content and have the text content bound to different properties on my underlying class. So this is the best I can come up with but the bindings are hard coded. So for every class bound to a combobox using this ItemContainerStyle I'd have to implement a "MainText" and "SubText" property. Question is, is there a way to have the binding soft coded so where the style referenced from a combobox I can specify which string properties of the

How to set style for ItemsPanel from outside?

半世苍凉 提交于 2020-01-05 07:08:56
问题 I define a style to make all StackPanel green: <Window.Resources> <Style TargetType="StackPanel"> <Setter Property="Background" Value="Green" /> </Style> </Window.Resources> But if I use StackPanel as panel template then it's NOT green: <UniformGrid> <StackPanel /><!-- this one is green --> <ItemsControl> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel /><!-- this one is not --> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </UniformGrid> Why? How to make it also