Copied XAML from one project to another, seeing error RRS feed

  • Question

  • Hi,


    I have the following simple XAML designer, DropHere.xaml, which I copied from one C# class library project to another.  The only change I made in the source was changing the namespace in both DropHere.xaml and DropHere.xaml.cs.  Both projects are .NET 4.0 class libraries 

    However, in the new copy, I'm getting errors.  

    Here's the source code:


    <sap:ActivityDesigner x:Class="TryActivities.DropHere"
            <!-- Collapse Data Template for Designer -->
            <DataTemplate x:Key="Collapsed">
                <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <TextBlock FontStyle="Italic" Foreground="Gray" HorizontalAlignment="Center">Double-click to view</TextBlock>
            <DataTemplate x:Key="Expanded">
                    <sap:WorkflowItemPresenter Item="{Binding Path=ModelItem.Body, Mode=TwoWay}"
                                            HintText="Drop activity here" />
            <!-- Expand/Collapse Style for Designer -->
            <Style x:Key="ExpandOrCollapsedStyle" TargetType="{x:Type ContentPresenter}">
                <Setter Property="ContentTemplate" Value="{DynamicResource Expanded}"/>
                    <DataTrigger Binding="{Binding Path=ShowExpanded}" Value="false">
                        <Setter Property="ContentTemplate" Value="{DynamicResource Collapsed}"/>

        <Grid >
            <ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}" Content="{Binding}"/>




    namespace TryActivities
        // Interaction logic for DropHere.xaml
        public partial class DropHere
            public DropHere()


    And here's the error:


    Type 'http://schemas.microsoft.com/winfx/2006/xaml/presentation:StackPanel' is not assignable to type 'http://schemas.microsoft.com/winfx/2006/xaml/presentation:FrameworkElementFactory' of member 'VisualTree'. File: DropHere.xaml Line: 14 Column: 14 Project: TryActivities

    It actually has this error twice, once for each StackPanel.
    What does this error mean? And why am I only getting it in my new project? 


    Friday, September 30, 2011 4:36 PM


  • I figured it out.  When I copied the file, the BuildAction went from "Page" to "XamlAppDef".  Changing it back to "Page" cured this error.
    Friday, September 30, 2011 6:19 PM