0

In VisualStudio 2008, the design surface is just empty since I added this style to App.xaml:

    <Style x:Key="RightAlignedCell" TargetType="data:DataGridCell">
        <Style.Setters>
            <Setter Property="HorizontalContentAlignment" Value="Right" />
        </Style.Setters>
    </Style>

and adding this required namespace at the top to make data: resolveable

xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

When running the Silverlight app, everything works fine. However the design surface is empty and I get this error showing up while editing the xaml:

Invalid attribute value data:DataGridCell for property TargetType

As said, this error is just something that happens during design-time. The compilation works just perfect. What am I doing wrong, why can't the designer properly resolve this namespace?

Update: Also when I move the style from App.xaml to Page.xaml, the designer works again.. Any ideas?

driAn
  • 3,245
  • 4
  • 41
  • 57

3 Answers3

0

Have you tried this one?

<Style x:Key="RightAlignedCell" TargetType="{x:Type data:DataGridCell}">
    <Style.Setters>
        <Setter Property="HorizontalContentAlignment" Value="Right" />
    </Style.Setters>
</Style>
Franci Penov
  • 74,861
  • 18
  • 132
  • 169
  • This causes the error "Invalid attribute value {x:Type data:DataGridCell} for property TargetType." – driAn Feb 26 '09 at 09:33
0

This seems to be a known bug according to the MS silverlight FAQ, no way to fix this.

driAn
  • 3,245
  • 4
  • 41
  • 57
0

Move xmlns declaration to resource dictionary. Like this: <ResourceDictionary xmlns:myconverters="clr-namespace:MyCustomConverters;assembly=MyCustomConverters"> ... </ResourceDictionary>

Example could be found here: blog.andrew-veresov.com/post/Silverlight-20-usage-of-the-converters-from-external-assembly-in-appxaml.aspx