Monday, August 20, 2012

The tag 'DataTrigger' does not exist in XML namespace?

The tag 'DataTrigger' does not exist in XML namespace?

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

Answers & Comments...

Answer: 1

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 this and this blog post or this SO question.

Answer by Anders Gustafsson for The tag 'DataTrigger' does not exist in XML namespace?




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog