datatrigger

Use DataTemplate.Triggers in WP8

被刻印的时光 ゝ 提交于 2019-12-13 00:26:58
问题 I am using an ItemsControl in WP application to show a list of objects ( bind an observable collection to this list). In WPF we can update the UI if any object properties is updated , but when it comes to WP8 , how can i do the same? Below is the syntax used in WPF , but in WP8 it shows Triggers not found <ItemsControl> <ItemsControl.ItemTemplate> <DataTemplate> <DataTemplate.Triggers> </DataTemplate.Triggers> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> how can i update UI in

Binding a Storyboard Animation inside a DataTrigger crashes the XamlParser

一曲冷凌霜 提交于 2019-12-12 18:22:34
问题 I want my application to animate an ellipse to a new position everytime a certain event happens. For testing purposes I made a button that changes a viewmodel property and this property is bound to a datatrigger that fires the animation, but later on I want the viewmodel to trigger it based on other events I haven't implemented yet - that's why I can't use the eventtrigger being bound to that button directly in the view, I need the viewmodel. Because the ellipse is supposed to be moved by the

Animate a linear brush using a data trigger

与世无争的帅哥 提交于 2019-12-12 15:31:10
问题 I am trying to animate a linear brush on a border using a data trigger but have come accross a problem where I cannot use the TargetName My code is as follows, can anyone suggest a way to resolve this? <Border Grid.Row="2" BorderThickness="10" Height="100" Width="100" > <Border.BorderBrush> <LinearGradientBrush> <GradientStop Color="Yellow" Offset="0.0" /> <GradientStop x:Name="gradient" Color="Orange" Offset="0.5" /> <GradientStop Color="Yellow" Offset="1.0" /> </LinearGradientBrush> <

DataTrigger in CellTemplate binding to HeaderTemplate; can it work?

人走茶凉 提交于 2019-12-12 10:03:45
问题 The goal here would be to check all grid checkboxes if the header checkbox changes: <Window.Resources> <Style TargetType="CheckBox" x:Key="InnerBox"> <Setter Property="HorizontalAlignment" Value="Center" /> <Style.Triggers> <DataTrigger Value="True" Binding="{Binding IsChecked, ElementName=HeaderCheckbox}"> <Setter Property="IsChecked" Value="True" /> </DataTrigger> <DataTrigger Value="False" Binding="{Binding IsChecked, ElementName=HeaderCheckbox}"> <Setter Property="IsChecked" Value="False"

hide Canvas depending on child's content

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 06:04:21
问题 this is my latest try to make the canvas Invisible whenever the label.Content is an empty String. Any help/advice appreciated, thanks. <Canvas Visibility="Visible"> <Label Content="" Name="holamouse" /> <Canvas.Resources> <Style TargetType="{x:Type Canvas}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=Content, ElementName=holamouse, UpdateSourceTrigger=PropertyChanged}" Value="{x:Static sys:String.Empty}"> <Setter Property="Canvas.Visibility" Value="Hidden"></Setter> </DataTrigger> <

Concatenated Text in TextBlock DataTrigger

折月煮酒 提交于 2019-12-12 05:53:43
问题 I try to work with a concatenated text in the setter of a textblock. textblock looks like that: <TextBlock> <Run Text="{x:Static languages:visuTexts.Lenght}" /> <Run Text="A [LA]"/> <TextBlock.Style> <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}"> <Style.Triggers> <DataTrigger Binding="{Binding Product.DiameterA}" Value="0"> <Setter Property="Text" Value="concatenated text here" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> i want to

ColorAnimation for TemplateBinding Background Property on DataTrigger

夙愿已清 提交于 2019-12-12 05:39:49
问题 I have a button with a Template , like below, <Button> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Border BorderBrush="Transparent"> <Path Stretch="Fill" Width="25" Height="25" Fill="{TemplateBinding Background}" > <Path.Data> <RectangleGeometry Rect="10,10 200,140"/> </Path.Data> </Path> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Button.Style> </Button> I am trying to animate the Background on a

Set property of ViewModel using setter within some Trigger

浪尽此生 提交于 2019-12-12 03:24:03
问题 I tried to google but all problems had related heading but problem context different. My problem is that I have a DataTrigger which gets triggered when certain property has a certain value i-e IsDockPanelVisible has true/false (different triggers for each value) in my case. Now when it gets triggered, it should set the value of Width - a property defined in ViewModel. Here is my specific code: <Style.Triggers> <DataTrigger Binding="{Binding IsDockPanelVisible}" Value="False"> <Setter Property

WPF DataGrid DataTrigger Binding on DataContext property

浪尽此生 提交于 2019-12-12 01:52:22
问题 What's the correct DataTrigger binding for DataContext properties? I have a DataGrid which is bound like this: XAML: <DataGrid x:Name="dataGrid" Grid.Row="4" Grid.ColumnSpan="2" ItemsSource="{Binding}" CellStyle="{StaticResource RowStateStyle}" > </DataGrid> In .cs the grid is bound to a DataTable, hence the DataContext for a cell is DataRowView, containing Row as a property: // DataTable containing lots of rows/columns dataGrid.DataContext = dataTable; Edit: Refering to ASh's solution I

How to make my custom UserControl handle a two-way Binding when it is inside a Template Setter inside a DataTrigger?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 16:42:54
问题 If I put the TimeSpanPicker directly in the UserControl element, it works. If I put a DateTimePicker (from the Extended WPF Toolkit) instead of my TimeSpanPicker, it works in both ways. (This situation is what I wish to use, it is in the code below) If I put the TimeSpanPicker in a Template Setter inside a DataTrigger inside Style.Triggers inside UserControl.Style, the Binding stops working. The binding that does not work in any way (although it is set to TwoWay) is this: TimeSpan="{Binding