Bug 28719 - Triggers inside DataTemplate give XAML runtime error
Summary: Triggers inside DataTemplate give XAML runtime error
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.1
Hardware: PC Windows
: Highest critical
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2015-04-03 05:28 UTC by Tibor Ebner
Modified: 2015-07-20 09:45 UTC (History)
13 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:


Attachments
Error still exists in Xamarin.Forms 1.4.3-pre3 (484.45 KB, application/octet-stream)
2015-06-17 05:55 UTC, Nicolas Hotterbeekx
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Tibor Ebner 2015-04-03 05:28:12 UTC
The title tells it all: it is not possible to use triggers (data triggers or multi-triggers at least) in a DataTemplate element in XAML. Runtime error given: 'The Property TargetType is required to create a Xamarin.Forms.DataTrigger object.'

More info:
https://forums.xamarin.com/discussion/comment/112712/#Comment_112712
Comment 1 Jeremy Herbison 2015-04-07 14:09:52 UTC
I can confirm this issue. The following inside a datatemplate does not work, with the specified error:

                <Image Grid.Row="0" Grid.Column="0">
                  <Image.Triggers>
                    <DataTrigger TargetType="Image" Binding="{Binding IsSelected}" Value="False">
                      <Setter Property="Source" Value="Add.png" />
                    </DataTrigger>
                    <DataTrigger TargetType="Image" Binding="{Binding IsSelected}" Value="True">
                      <Setter Property="Source" Value="Remove.png" />
                    </DataTrigger>
                  </Image.Triggers>
                </Image>
Comment 2 Nicolas Hotterbeekx 2015-06-17 05:55:55 UTC
Created attachment 11643 [details]
Error still exists in Xamarin.Forms 1.4.3-pre3
Comment 3 Jason Smith [MSFT] 2015-06-18 03:58:28 UTC
The new reproduction will be fixed in 1.4.3 final
Comment 4 Parmendra Kumar 2015-07-20 09:45:35 UTC
I have checked this issue with Xamarin.Forms 1.4.4-pre2 and its working fine at my end.

Hence closing this issue.