datatrigger

WPF/XAML - compare the "SelectedIndex" of two comboboxes (DataTrigger?)

hello, i've got two comboboxes with the same content. the user should not be allowed to choose the same item twice. therefore the comboboxes' contents (= selectedindex?) should never be equal. my first attempt was to comapare the selectedindex with a datatrigger to show/hide a button: <DataTrigger Binding="{Binding ElementName=comboBo...

Updating DataTrigger manually or run synchroniously

Hello, I hope you can help me, I have a problem with WPF DataBinding in a FlowDocument. Here's a short description what I want to do: My aim is to print or export a XPS-Document which is build from a FlowDocument. In the FlowDocument I set some XML-Bindings which should represent the content of the XMLNode. In my XMLSource i'm storing v...

How to change a WPF window backgroud with a data trigger?

I want to change the background color of our apps main window when a property changes. We have a business date that can be changed and I want to change the window background when it has changed from expected. I've set up a property to tell this. But can I set a style datatrigger on a window that changes itself? Or would I need to do ...

DataTrigger not firing

I have the following xaml: <DockPanel> <DockPanel> <CheckBox IsChecked="{Binding Path=Test}" /> <CheckBox IsChecked="{Binding Path=Test}" /> </DockPanel> <DockPanel DockPanel.Dock="Left" Width="10" Background="Blue"> <DockPanel.Style> <Style> <Style.Triggers> ...

WPF Trigger based on Object Type

Is there a way to do a comparison on object type for a trigger? <DataTrigger Binding="{Binding SelectedItem}" Value="SelectedItem's Type"> </DataTrigger> Background: I have a Toolbar and I want to Hide button's depending on what subclass is currently set to the selected item object. Thanks ...

define animations and triggers as reusable resource?

Is there a way to define an animation somewhere in xaml (eg. as a resource) once and then reuse it multiple times? I have a lot of independent brushes across differnt datatemplates that independently need to start the same kind of animation based on a datatrigger. Now since it seems that an animation has to define an Storyboard.TargetNam...

WPF Animation "Cannot freeze this Storyboard timeline tree for use across threads"

I currently have a listbox that has its selected item bound to a property on my ViewModel. Whenever the selected item isn't null I want to perform an animation on it. However I keep getting the following error "Cannot freeze this Storyboard timeline tree for use across threads" and from research sort of understand why this is happenin...

start animation that begins with current value (handoff)

I have a WPF Datatemplate that contains a some DataTriggers that start animating the color of a visual. How can I start the animation beginning with the actual value the color propery currently has? Since there might be another animation currently acitve I can not start a new one but when I remove the animation using DataTriggers ExitAct...

Remove storyboard but keep animated value?

How can I remove a storyboard in XAML (i.e. RemoveStoryboard action in a DataTrigger) but keep the value that was animated. Similar to the Animatable.BeginAnimation: If the animation's BeginTime is null, any current animations will be removed and the current value of the property will be held. ...

What's wrong with my datatrigger binding?

I have created an attached property to extend a Button class with additional state: <Button v:ExtensionHelper.OperationMode="{Binding MyObject.OperationMode}" Command="{Binding MyObject.Select}" Style="{StaticResource operationModeControlTemplateStyle}" /> Then I want to acces this value in the controltemplate using Datatriggers like ...

How to determine index of current ListBox item from DataTemplate?

I have a ListBox. Now I want to write a DataTemplate in such way, that the first item will have red background and white background for other items. I guess I need to write a DataTrigger, but I have no idea how do determine that DataTemplate is applying to the first item. ...

DataTrigger does not work as expected

I have a combobox bound to a ViewModel property called "Property". "Property" is a TypeDescriptor. When user changes value in combobox the "Property" is updated. On the UI i would like to either hide or make visible different controls: textbox, combobox, date picker etc. Problem is datatrigger is not working as expected. <Style x:Ke...

Simple WPF IValueConverter and DataTrigger not working together

I've been having trouble using a value converter with a data trigger. In some of my code it seems like the DataTrigger's Path is being applied to the root element, rather than the element which the style applies to. I created a simple test case, and I don't understand its behavior. I'm expecting the Button to turn red or blue depending ...

DataTrigger / Style quick in XAML

Hey I have an Ellipse defined as so <Ellipse Stroke="#FF474747" Style="{StaticResource SelectedTemplate}" Fill="{StaticResource RedGradient}" /> I also have two styles setup like so <RadialGradientBrush x:Key="RedGradient" GradientOrigin="1,1"> <GradientStop Color="White"/> <GradientStop Color="Red" Offset="1"/> </RadialGrad...

How to change cell background in ListView when data changes?

I have ListView with binding on ObservableCollection which has INotifyPropertyChanged implemented. When user open window, data will be displayed but I want to change backgorund on cells where data was changed in meanwhile... I have been trying with Data triggers, but they can be triggered just on certain values. I want to trigger when v...

WPF DataTrigger - Setting ListBoxItem IsSelected

I have the following data trigger on the ListBoxItems in my Multi-selection ListBox <DataTrigger Value="True"> <DataTrigger.Binding> <MultiBinding Converter="{StaticResource DisableWorkItemConverter}"> <Binding ElementName="MainForm" Path="PickedWorkItemID"/> <Binding Path="Id"/> </MultiBindin...

WPF Datagrid not respect change of item property value

Hi all, my problem is here: I have some class public class Component { ... private ServiceController service; ... public int ServiceStatus { get { switch(service.Status) { case ServiceControllerStatus.Stopped: return 0; case...

Using custom dependency properties as DataTrigger in WPF

I have a custom dependency property that I would like to use as a data trigger. Here is the code behind: public static readonly DependencyProperty BioinsulatorScannedProperty = DependencyProperty.Register( "BioinsulatorScanned", typeof(bool), typeof(DisposablesDisplay), new FrameworkPropertyMetadat...

What is causing the error 'Must specifiy both property and value for setter'?

I have a style which toggles the visibility of an image depending on an underlying DataContext property. Unfortunately I keep getting an error: 'Must specify both property and value for setter' The XAML looks like <Style TargetType="{x:Type igDP:LabelPresenter}" x:Key="BuySellLabelStyle"> <Setter Property="Template"> ...

Is it possible to view effects of data triggers in design in Expression Blend 3?

Blend supports displaying the graphical representation of a style resource, and allows you to select an active property/event trigger to view or modify. However, it's a common occurrence to have visual elements controlled by DataTriggers. Is it possible to tell the designer that it should consider a DataTrigger 'active' so that its visua...