datatrigger

WPF Triggers

折月煮酒 提交于 2019-11-30 20:31:22
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 works ! The textblock text=xxx inside it, doesn't. This is my attempts(s) <wpfToolkit:DataGridTemplateColumn Header="P" Width="20"> <wpfToolkit:DataGridTemplateColumn.CellTemplate> <DataTemplate> <!-- <DataTemplate.Triggers> --> <!-- <DataTrigger Binding="{Binding

datatrigger binding to viewmodel property

会有一股神秘感。 提交于 2019-11-30 18:55:27
I'm trying to create a simple style data trigger that pulls it's binding value from a viewmodel property, as you can see below: <StackPanel Name="stackTextPanel" Orientation="Horizontal" Margin="0,8,0,0"> <StackPanel.Style> <Style TargetType="{x:Type StackPanel}"> <Style.Triggers> <DataTrigger Binding="{Binding QuickDrawBarPinned}" Value="False"> <Setter Property="Margin" Value="0,8,0,0" /> </DataTrigger> <DataTrigger Binding="{Binding QuickDrawBarPinned}" Value="True"> <Setter Property="Margin" Value="0,48,0,0" /> </DataTrigger> </Style.Triggers> </Style> </StackPanel.Style> I have also tried

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

∥☆過路亽.° 提交于 2019-11-30 14:08:51
问题 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 wondering where I can specify the Image corrosponding to each item of Enum value in a combobox? Is that possible through data trigger ? I really appreciate if anyone have the

SQL Server trigger on insert,delete & update on table

白昼怎懂夜的黑 提交于 2019-11-30 13:06:33
I have a table Product and another table ProductLog . The log table needs to track two columns in the Product table. Each time there is an insert, update or delete on those columns I need to update the log table. Do I need to write three separate triggers, or can one trigger handle these operations? I also need to know the type of operation, for example I will need to know if the entry in the log table was because of insert or delete or update. If any one give me an example that would be great. You need just one trigger CREATE TRIGGER [ProductAfter] ON [Product] AFTER INSERT, UPDATE, DELETE

Triggers collection members must be of type EventTrigger

给你一囗甜甜゛ 提交于 2019-11-30 11:10:54
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" /> </StackPanel> </UserControl> I've been trying to use a DataTrigger to make the 'Launch' StackPanel become visible when the ToggleButton is checked, and remain collapsed otherwise. However, at runtime I get an error stating "Failed object initialization (ISupportInitialize.EndInit). Triggers collection

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

最后都变了- 提交于 2019-11-30 09:32:27
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 wondering where I can specify the Image corrosponding to each item of Enum value in a combobox? Is that possible through data trigger ? I really appreciate if anyone have the XAML for this scenario. Many Thanks in advance You can use a DataTrigger, but would be more maintainable

MultiDataTrigger vs DataTrigger with multibinding

戏子无情 提交于 2019-11-30 06:14:34
I encountered a situation where I can easily achieve the same functionality by using a MultiDataTrigger or, alternately, using a DataTrigger with a MultiBinding . Are there any substantive reasons to prefer one approach over the other? With MultiDataTrigger: <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=SomePath}" Value="SomeValue"/> <Condition Binding="{Binding Path=SomeOtherPath, Converter={StaticResource SomeConverter}}" Value="SomeOtherValue"/> </MultiDataTrigger.Conditions> <MultiDataTrigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource

WPF Triggers

我是研究僧i 提交于 2019-11-30 04:59:17
问题 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 works ! The textblock text=xxx inside it, doesn't. This is my attempts(s) <wpfToolkit:DataGridTemplateColumn Header="P" Width="20"> <wpfToolkit:DataGridTemplateColumn

datatrigger binding to viewmodel property

北慕城南 提交于 2019-11-30 03:13:30
问题 I'm trying to create a simple style data trigger that pulls it's binding value from a viewmodel property, as you can see below: <StackPanel Name="stackTextPanel" Orientation="Horizontal" Margin="0,8,0,0"> <StackPanel.Style> <Style TargetType="{x:Type StackPanel}"> <Style.Triggers> <DataTrigger Binding="{Binding QuickDrawBarPinned}" Value="False"> <Setter Property="Margin" Value="0,8,0,0" /> </DataTrigger> <DataTrigger Binding="{Binding QuickDrawBarPinned}" Value="True"> <Setter Property=

WPF Trigger based on Object Type

喜夏-厌秋 提交于 2019-11-30 01:19:30
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 Why not just use a converter that takes an object and returns a string of the object type? Binding="{Binding SelectedItem, Converter={StaticResource ObjectToTypeString}}" and define the converter as: public class ObjectToTypeStringConverter : IValueConverter { public object Convert( object value, Type