multidatatrigger

WPF MultiDataTrigger AND condition

房东的猫 提交于 2020-01-13 10:22:08
问题 I would like to enable a button only when both of my two datagrids have selected items. Right now it is enabled when either of the datagrids have selections. Any ideas? <Button x:Name="button" Content="Z" Grid.Column="1" Margin="0,240,0,0" VerticalAlignment="Top" FontFamily="Wingdings 3" FontSize="21.333" ToolTip="Set the selected alarm for the selected alarm time"> <Button.Style> <Style TargetType="Button"> <Setter Property="IsEnabled" Value="True" /> <Setter Property="Opacity" Value="1" />

Styling a ListBoxItem depending on its index in the ListBox

跟風遠走 提交于 2020-01-04 15:15:21
问题 I want to change the margin of the first item in the ListBox if SomeProperty value is 10, without code-behind. This is what I have so far: <ListBox x:Class="Windows.CustomList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Windows" mc:Ignorable="d" x:Name="MyList

How to check if a row has odd number?

微笑、不失礼 提交于 2020-01-04 06:15:54
问题 I'm trying to set different color for odd rows using XAML. The datagrid in question has 3 different types of data, which I want to color differently, and simply changing AlternatingRowBackground won't do. I'm planning on using something like <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Type}" Value="0"/> <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="False"/> <Condition Binding="{Binding IsOddRow, RelativeSource=

DataTrigger Error

半腔热情 提交于 2020-01-03 05:55:04
问题 I am working with some multi-trriggers as per this posting. The binding and error are below. I am using a custom markup extension to display the resource image so it could be suspect but I don't think so since I have used it in styles before. The error message says I am applying the wrong property for the type and I don't see why yet. Cheers, Berryl triggers <Style x:Key="AvatarPathImageStyle" TargetType="{x:Type Image}"> <Setter Property="Source" Value="{Binding AvatarPath}"/> <Setter

Usage DataTrigger in WPF

落花浮王杯 提交于 2019-12-23 03:13:38
问题 I have a TextBox control defined in XAML and I want to apply different background colors to the TextBox based on its IsReadOnly or IsEnabled properties. I used dataTriggers to actually switch between the colors as shown below: <Style x:Key="TextBoxStyle" TargetType="TextBox"> <Style.Triggers> <DataTrigger Binding="{Binding IsEnabled}" Value="True"> <Setter Property="TextBox.Background" Value="Yellow"/> </DataTrigger> <DataTrigger Binding="{Binding IsReadOnly}" Value="True"> <Setter Property=

Binding to AlternationCount of ItemsControl from ItemTemplate of a nested ItemsControl

こ雲淡風輕ζ 提交于 2019-12-13 05:24:41
问题 I have an ItemsControl nested in the DataTemplate of another ItemsControl. This seemed like the easiest way to display a grid of numbers from a two-dimensional array, which it did very nicely. The problem I have is that I want to change the color a particular number in the grid. I was hoping to trigger off the AlternationIndex of both ItemsControls, so I can identify exactly which number to highlight. In the DataContext for the parent ItemsControl I have a 2-D array of integers like this:

DataTrigger does not fire on a derived class of a Button

此生再无相见时 提交于 2019-12-13 04:48:26
问题 We have a ton of Buttons with an Icon and Text across the App, and I am trying to extract a common style for all of them. I came up with this idea of deriving from a Button and have a couple of dependency properties. This custom button class has a style common to all the Buttons in our Application. My Custom Button definition: <Button x:Class="UIElements.Controls.CustomToolBarButton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx

cannot set tooltip in style

左心房为你撑大大i 提交于 2019-12-11 18:05:08
问题 I searched and find out I can't set the tooltip in setter.value directly (in a style.xaml file). However I can use static resource to set the tooltip. My question is, since I need to supply dynamic text for the tooltip, I can't use static resource. How should I do that? here is my example. <Style x:Key="ErrorStyleRadius" TargetType="{x:Type FrameworkElement}"> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding (Validation.HasError), RelativeSource=

How can I use Grid.Row Property as a DataBinding Path for a MultiDataTrigger Condition?

感情迁移 提交于 2019-12-11 10:33:32
问题 I'd like to set a MultiDataTrigger for a TextBox as shown in the code below. If IsNormal property, which I defined in the code-behind, is false and the TextBox is in the 2nd row of a Grid, IsEnabled of it should be false. However, the Condition regarding the Grid.Row does not work properly. Could you tell me how it is possible to use a Grid.Row property as a binding path in this case? <Style TargetType="TextBox"> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition

Bind to element within Usercontrol from other Xaml file

你。 提交于 2019-12-10 17:54:30
问题 Could anyone tell me how i can bind to a Element of a Usercontrol? Im trying to disable/enable a button using a datatrigger working together with IDataErrorInfo. so i usually do this like this when the elements are on the same view <Button Name="AddEditButton" Content="{Binding ButtonContent}" Command="{Binding AddCustomerCommand}" HorizontalAlignment="Center" Margin="0 10" > <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="IsEnabled" Value="false" /> <Style.Triggers>