datatrigger

How to change ListBox DataTemplate in WPF based on CheckBox

I am trying to apply a DataTrigger to change the DataTemplate for a listbox and am getting the error "Error 1 Cannot find the Trigger target 'IssueListBox'. (The target must appear before any Setters, Triggers, or Conditions that use it.)" I have a Listbox in my Main Window (In a DockPanel along with other Controls): <ListBox x:Name...

WPF listbox datatrigger hide selected

I have a listbox which has a datatemplate. Within the template I've got a trigger to hide a lsitboxitem if it's IsDeleted property is set to true. <DataTrigger Binding="{Binding Path=IsDeleted}" Value="True"> <Setter Property="Visibility" Value="Collapsed" /> </DataTrigger> This work OK but the problem I have is that the listbox its...

Unable to set ContentTemplate via DataTrigger.

I want the ContentTemplate to vary according to the value in the DataTrigger. And yes, I considered using a DataTemplateSelector, but now I need a DataTrigger or better said a MultiDataTrigger. Please take a look at the following sampe app, the DataTemplate doesn't change: <Window x:Class="Window1" xmlns="http://schemas.microsoft.co...

WPF Setting Image.Source from DataTrigger

Guys, I'm trying to define a DataTrigger for an Image element so that it shows a connected/disconnected image. I keep getting an Invalid PropertyDescriptor message. Any ideas? <Image> <Image.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding Source={x:Static my:Server.Instance}, Path=Connected, M...

WPF Highlight Item

I have a ViewModel that provides a collection of Items. There is also a ActiveItem propery. The Items collection may or may not contain ActiveItem. What I want to do (in XAML) is display the items as a list and highlight any of the items that are equal to Active Item. I have tried the following with no success: <ListBox ItemsSource="{...

WPF DataTrigger not firing when Application style applied???

Hi guys, Any help on this problem would be greatly appreciated as I have been looking around all day for answers surrounding this area! I have applied a global style to my WPF application by adding in a merged dictionary to the App.xaml. This has applied the style across the application like intended but there are a number of things t...

Add bound DependancyProperty to button to control image displayed

Here is a simplification of the problem I want a Button with an extra DependancyProperty that I can bind to. The value of this property will control which image is selcted on the button. Question 2 is do I create a UserControl and draw the button on. If so how do I can use triggers to manage the image BUT I do not know how to do the T...

Changing UserControl background based on SelectedValue from combobox

What I try to do: I have a list of person profiles in the background that I use with my combobox. The trigger is to change the background based on the gender of the person (bool Role.IsFemale). When I handle the SelectionChangedEvent in the code, I can see the Selectedvalue is true or false. I could now change the background directly or ...

HowTo animate filtering of items displayed in an ItemsControl (WPF)

Hi, I'm currently creating a control that is mainly just an ItemsControl displaying some items. In addition I have some controls which allows the user to filter the items in that ItemsControl. What I'm trying to do is to make it better visible to the user which items are removed when the filter is applied. So what I did was instead of...

WPF: Using bindings in data trigger condition

Let's say I have the following simple classes: public class Person { public int Id { get; set; } public string Name { get; set; } } public class PersonHolder { public Person CurrentPerson { get; set; } public int ActiveId { get; set; } } Now I have a grid with an instance of class PersonHolder as DataContext, and in ...

Databinding to XML in a DataTrigger in WPF

In a WPF application, I have correctly bound a DataTemplate to an XML node that looks like: <answer answer="Tree", correct="false" score="10" /> In my application, I have a TextBlock with the answer in it. At first, I want it invisible, but when the correct attribute in the XML file changes to "true", it must become visible. My DataT...

DataTriggers in Expression Blend

I have a listbox that displays Shipment Items (custom class) that are formatted using a datatemplate (see below). There is a border element in the template (I am calling it a Gem) that displays which item is active (not selected) which will be the item to which products will be added. template.png There is a boolean property in the sh...

WPF DataTrigger not firing outside of ItemsControl

I have a Custom UserControl that extends the button control and adds two new dependency properites IsActive and Icon. In the control there are DataTriggers that set the Icon and the Active state based on the value. The issue I am having is that the control only working inside of an ItemControl. Here is the XAML portion of the contro...

WPF DataTrigger cannot find Trigger Target

<ListBox.ItemTemplate> <DataTemplate> <Grid x:Name="grid"> <Grid.Background> <SolidColorBrush x:Name="backgroundBrush" Color="Transparent" Opacity="0.1"/> </Grid.Background> </Grid> <DataTemplate.Triggers> <DataTrigger Binding="{Binding IsExpanded}" Value="Tr...

WPF: Activate Trigger when a MVVM bound property changes

Hi, somehow I am going in circles here. Please forgive me if the answer to this question is obvious. I want to react to changed properties in the ViewModel in the View. When the properties (bool) change the View should start an animation (BeginStoryBoard). Actually in my application there are 4 of these properties each with its own nam...

wpf datatrigger on an image source

Assuming the binding is right and the image files are where they shuld be, can anyone spot why the image in the xaml below won't change when the trigger evaluates to true? Cheers, Berryl <Image Source="..\..\Images\OK.png" Grid.Column="2" Stretch="None"> <Image.Style> <Style> ...

Datatrigger on textbox not working

Hi i am trying to write a datatrigger in which i have to clear a textbox content on checkbox checked.My Code is given below It works as long as you dont type anything in the textbox.As soon as i type in the textbox the datatrigger fails to work.How can i solve this <Window x:Class="CheckboxTextbox.Window1" xmlns="http://schemas.mic...

DataTrigger not reevaluating after property changes

[Original] I have a listbox which has its itemssource (this is done in the code behind on as the window is created) databound to an observable collection. The List box then has the following data template assigned against the items: usercontrol.xaml ... <ListBox x:Name="communicatorListPhoneControls" ItemContainerStyle="{Sta...

DataTrigger doesn't work

I have this in XAML in my style: <DataTrigger Binding="{Binding Path=ButtonStyle}" Value="CutLeft"> <DataTrigger.Setters> <Setter Property="CornerRadius" TargetName="border" Value="0 11 11 0" /> <Setter Property="CornerRadius" TargetName="border1" Value="0 10 10 0" /> </DataTrigger.Setters> </DataTrigger> And this XAML in ...

Silverlight 4.0: MultiDataTrigger

Is there a way just like multidatatrigger behavior of WPF also implemented in Silverlight 4.0? OR Another workaround which behaves like multidatatrigger? ...