datatrigger

DataTrigger only works on first TabItem in TabControl

Hi! It seems like a bug in WPF, but maybe someone has an answers to this. I have a DataTrigger for an editable ComboBox. It works on the first TabItem of my TabControl, but not on the second. If you switch the first with the second TabItem, the "second" will work. The same effect happens when you give the style exactly to the ComboBox (C...

Problem with DataTrigger binding - setters are not being called

I have a Command bound to a Button in XAML. When executed, the command changes a property value on the underlying DataContext. I would like the button's Content to reflect the new value of the property. This works*: <Button Command="{x:Static Member=local:MyCommands.TestCommand}" Content="{Binding Path=TestProperty, Mode=OneWay...

MySQL Trigger with dynamic table name

I've look around a bit and can't quite find an answer to my problem: I want a trigger to execute after an insert on a table and to take that data that is being inserted and do two things Create a new table from the client id and partner id Insert the 'data' that just was inserted into the new table I am fairly new to the Stored proc...

How to declare combobox itemTemplate that has Itemsource as Enum Values in WPF?

I have a enum let's say enum MyEnum { FirstImage, SecondImage, ThirdImage, FourthImage }; I have binded this Enum to my combobox in XAML. While defining an combobox I have defined an ItemTemplate of combox to take Two UI element: TextBlock that show the enum value (Description) Image I have done this much in XAML. I am...

UserControl DataTrigger

Hi, I have a UserControl with the following XAML in its Triggers collection... x:Name="aControl" <UserControl.Triggers> <DataTrigger Binding="{Binding ElementName=aControl, Path=InSync}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard Storyboard.Targe...

Wpf combobox selection change breaks Datatrigger

Hi, I am trying to set the selected value of a combobox from a style trigger.It works as long as we dont manually change any value in the combobox.But it stops working altogether after manually changing the selection.How can i solve this.A sample code is attached.Please do help <Window x:Class="InputGesture.Window2" xmlns="http://s...

WPF Toolkit DataGridCell Style DataTrigger

I am trying to change the color of a cell to Yellow if the value has been updated in the DataGrid. My XAML: <toolkit:DataGrid x:Name="TheGrid" ItemsSource="{Binding}" IsReadOnly="False" CanUserAddRows="False" CanUserResizeRows="False" AutoGenerate...

WPF Trigger / Style overrides another

I have a listview defined as such <ListView Width="auto" SelectionMode="Single" ItemContainerStyle="{StaticResource ItemContStyle}" .... Then in "baseListViewStyle" I have defined some base styles to apply to my lis...

C# WPF provide a dependency property of a control to a converter in the control?

I have two objects, Culture and Translation, neither of which are complicated. Culture is like a simple CultureInfo, but with an extra field. Cultures likely won't change often, and there won't be many to begin with. However, there will be many Translations, and each Translation has a CultureID property. Translations each have a Trans...

DataTrigger with Value Binding

Why this doesn't work? <Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=Asset}" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=CurrentAsset}"> <Setter Property="B...

WPF Trigger when Property and Data value are true

I need to be able to change the style of a control when a property and data value are true. For example, my bound data has an IsDirty property. I would like to change the background color of my control when IsDirty is true AND the control is selected. I found the MultiTrigger and MultiDataTrigger classes...but in this case I need to some...

Grid MouseOver with data condition

I have a listbox with a ItemTemplate which defines a Grid. The grid has a style which sets the background and foreground based on data bindings. <Style x:Key="GridStyle1" TargetType="{x:Type Grid}"> <Style.Triggers> <DataTrigger Binding="{Binding StoryType}" Value="Release"> <Setter Property="Bac...

DataTrigger inside ControlTemplate doesn't update

I have a ListBox that is bound to a list of CustomerViewModel-objects, that each has two dependency properties: - Name (string) - Description (string) - IsVisible (bool) (the IsVisible property is True by default and is reversed via the ToggleVisibility Command on the CustomerViewModel) I would like to display the Name and Descriptio...

WPF TextBlock Negative Number In Red

I am trying to figure out the best way to create a style/trigger to set foreground to Red, when value is < 0. what is the best way to do this? I'm assuming DataTrigger, but how can I check for negative value, do i have to create my own IValueConverter? ...

WPF change Button Content on ViewModel.PropertyChanged event

My attempt (below) fails: <Canvas x:Key="Lock" ... /> <Canvas x:Key="Unlock" ... /> <Style x:Key="LockButtonStyle" TargetType="{x:Type Button}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsReadOnly}" Value="True"> <DataTrigger.Setters> <Setter Property="Content" Value="{StaticResource...

WPF Datatrigger for DataGrid only changing the entire row

Hi, I've got a datagrid with a datatrigger set. When it's value is "UP" I'd like the trigger to only change the background in the 'directionColumn' datagridcolumn only. What i've got so far updates the entire row. I also tried placing 'targetname' in the setter element but that just gives an error. Please help Thanks the xaml: <...

DataTriggers firing when virtualized contaniers come back into view

I have a xamdatagrid which has a large number of rows. These rows are being virtualized by the xamdatagrid (in a "recycle" mode). My problem is that the data triggers which are associated with these rows seem to be firing when the rows come back into view. Has anyone else experienced this before? IS there some way of detecting a row ...

WPF Style datatrigger on Border background

I have the border below. Why would the Foreground of my TextBlock work correctly but the Background of the border always stay the same (as if the IsDeleted property is always false) <Border DockPanel.Dock="Top" BorderBrush="Black" Background="#CBE2FF" BorderThickness="2" CornerRadius="5" Padding="0" Margin="5"> <Border.Style...

WPF Style DataTriggers

Hi I have a Data Trigger in a style targeting a TextBlock where I am trying to change the Text and background of a TextBlock <DataTrigger Binding="{Binding ElementName=..., Path=IsVisible}" Value="False"> <DataTrigger.Setters> <Setter Property="Text" Value="Collaps"></Setter> <Setter Property="Background" Value="Somethin...

How to set DataTrigger value to const field?

I have class with const fields like this Areas { public const int Area1Id = 1; public const int Area2Id = 2; public const int Area3Id = 3; } And a template which is binded to Area class. Area class has int TypeId property, and I want to show different things depending TypeId property Code like this works perfectly <DataTrigge...