I have the following XAML:
<TextBlock Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}" Margin="0,0,5,0"/>
<TextBlock Text="items selected">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=EditListBox, Path=...
I have a DataTrigger defined in my XAML which I want to use in several places. Is it possible to define it as a resource and then share it?
Here's my trigger:
<TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding HasCurrentTest}" Value="True">
<Setter Property="TextBlock.Visib...
I have a checkbox in GridViewColumn which i use for show/change database value. The click event for the checkbox is used for change value in the database. For handling the state of property "IsChecked" I'm using datatrigger and a setter, se xaml code below:
<Style TargetType="CheckBox">
<Setter Property="IsEnabled" Value="True" />
...
I know that I can make a setter that checks to see if a value is NULL and do something. Example:
<TextBlock>
<TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding SomeField}" Value="{x:Null}">
<Setter Property="TextBlock.Text" Value="It's NULL Baby!" />
</DataTrigger>
</Sty...
I have a WPF App that implements a ListView. I would like to show an image (a small icon) in one of the columns depending on the type of the data that row represents. Sort of like the display you see in Windows Explorer.
I am using DataTriggers elsewhere in my XAML, it seems like a similar method could be used to swap out entire cell c...
I have a grid laid out like so;
+---------+---------+
| Image | Details |
| is | pane |
| here | for data|
| | entry |
+---------+---------+
| ListView here to |
| select data item |
| for top two panes |
+---------+---------+
This all works well, but I would now like to change the image to another set of cont...
Hello,
I have a listview that you select a row/item on. This is linked to a datatrigger that displays an image on the row. The image should only be displayed when the row is selected.
This part works fine, however when you move the focus to something else, such as a textbox, or a messagebox is displayed, the listviewitem loses focus ie ...
Hi,
I'm trying to set a trigger to display a block of text when the value i get for the cell is a certain type.
I have successfully managed to display an image in the same situation, but in this circumstance i don't want an image, but some text.
Have commented out lines in order to test.try to make it work. The commented out code work...
Hi
I have the following XAML:
<Grid x:Name="root">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Resources>
<DataTemplate DataType="{x:Type ViewModels:TemplateViewModel}">
<ContentControl Content="{Binding}" Grid.Row="0" x:Name="ct">
<ContentControl...
I seem to be having a hard time today. All I want to do is make a TextBox hidden of visible based on a bool value databound to the Window its hosted in.
What I have just won't compile and I don't understand why. Please help.
<TextBlock Grid.Column="2" Text="This order will be sent to accounting for approval" Foreground="Red" Vertical...
I'm trying to animate the ScaleY property of a LayoutTransform based on a DataTrigger bound to a boolean on my ViewModel class. The animation happens when the value is first seen to be false by the DataTrigger (when the application first starts) and when i first change it to true in a checkbox's checked event but not when i set it to fa...
I'm having a problem understanding the basics of databinding in WPF. I have a generic DataGrid (with AutoGenerateColumns set) that is bound to a DataTable with column names that vary on every load. When the dataTable contains columns that are of type boolean, I want to render a column that contains custom images representing true and fal...
I've got the following XAML used to display detailed information about an item selected in a list view. I want the rectangle to show the standard info color behind the text except when the selected item represents an error message. The code below doesn't work as is and always shows the info color. It works great if I don't specify a Fill...
I've created a UserControl, similar to the following:
<UserControl>
<StackPanel Orientation="Vertical">
<StackPanel x:Name="Launch" Orientation="Horizontal" Visibility="Collapsed">
<!-- Children here -->
</StackPanel>
<ToggleButton x:Name="ToggleLaunch" IsChecked="False" Content="Launch" />
...
I'm trying to use MultiDataTriggers to enabled/disable a button based on the value of two text boxes.
The docs state that the conditions in a MultiDataTrigger are logically ANDed together. In the example below if txtFirst.Text is foo and txtSecond.Text is bar I'd like to enable the button. However, the button always stays disabled (IsE...
In my M-V-VM application I have to show the user's avatar. The image is provided in a property of type ImageSource the ViewModel object. So that's what I have currently:
<Image Source="{Binding Path=UserAvatar}"/>
However, some users may not have an avatar configured, so UserAvatar is null. In that case I want to show a default avatar...
I have a custom UserControl which has a DependencyProperty "ItemTemplate" of type "DataTemplate". I create an instance of this ItemTemplate via .LoadContent(), assign the .DataContext and put it an ContentControl. The only drawback I have is that DataTemplate.Triggers are not fired.
Example Xaml Code:
<Window.Resources>
<DataTempla...
What is wrong with the following ControlTemplate why can't it find the named Brush? I alway get the error Cannot find the Trigger target 'stateBrush'. In my template I would start to animate the background when the state changes to WaitForActive and I want to set it to green when the state changes to Active. Pretty simple. Is my approach...
I have a listbox with a datatemplate that contains a number of comboboxes.
I've currently got a datatrigger on the datatemplate to change the bindingsource (to a different objectdataprovider resource declared in my xaml) of one of the comboboxes depending upon the selectedvalue of another combo.
What I'd like to do is have a parameter...
This code works (when ControlType="dropDown" then the background yellow):
<Window x:Class="TestCollapsed.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:TestCollapsed.Commands"
Title="Main Window" Height="400" ...