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?
Have you tried this one?
<Style x:Key="RightAlignedCell" TargetType="{x:Type data:DataGridCell}">
<Style.Setters>
<Setter Property="HorizontalContentAlignment" Value="Right" />
</Style.Setters>
</Style>
This seems to be a known bug according to the MS silverlight FAQ, no way to fix this.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.