Reputation: 3283
I am getting a really annoying error
Error 175 The tag 'DataTrigger' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.
I am using Visual Studio 2010 with Silverlight 5. As far as I can tell the references are ok but obviously not, can someone tell me what is causing this please
I believe this may resolve the other question I raised earlier but cant test it because of this error
Change DataTemplate to use depending on condition
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:iv="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
mc:Ignorable="d"
>
<UserControl.Resources>
<DataTemplate x:Key="SelectControl">
<ContentControl Content="{Binding}">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Style.Triggers>
<DataTrigger Binding="{Binding BlockType}" Value="Locked">
<Setter Property="DataTemplate"
Value="{StaticResource LockedClip}" />
</DataTrigger>
<DataTrigger Binding="{Binding BlockType}" Value="Unlocked">
<Setter Property="DataTemplate"
Value="{StaticResource UnlockedClip}" />
</DataTrigger>
<DataTrigger Binding="{Binding BlockType}" Value="Unlock">
<Setter Property="DataTemplate"
Value="{StaticResource UnlockClip}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
<DataTemplate x:Key="LockedClip">
<my:SingleLockedFlexBlock Height="117"/>
</DataTemplate>
<DataTemplate x:Key="UnlockedClip">
<my:SingleLockedFlexBlock Height="50"/>
</DataTemplate>
<DataTemplate x:Key="UnlockClip">
<my:SingleLockedFlexBlock Height="200"/>
</DataTemplate>
Hope someone can shed light on this?
Paul
Upvotes: 0
Views: 3686
Reputation: 15981
DataTrigger
is not supported by default in Silverlight, but you could use the SDK from the Blend Preview for SL5 to obtain corresponding behavior.
You might want to take a look at:
XAML code wise, I believe you need to change the following:
<Style.Triggers>
<DataTrigger Binding="{Binding BlockType}" Value="Locked">
<Setter Property="DataTemplate"
Value="{StaticResource LockedClip}" />
</DataTrigger>
...
into the following:
<iv:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding BlockType}" Value="Locked">
<ei:ChangePropertyAction PropertyName="DataTemplate"
Value="{StaticResource LockedClip}" />
</ei:DataTrigger>
...
Upvotes: 2