Adhoc Resource Style setters causing failure - Tips Question RRS feed

  • Question

  • Howdy folks,

          I was in digging around a SL4 project cleaning up some XAML and noticed the bug I found reported here. What I'm wondering is, would this only effect the design view in the VS2010 Cider Designer (since Blend doesn't seem to care and the project still appears to build fine) or is there a possibility it could adversely effect something down the road and I should compromise with setting the properties per instance?

    So for example say I want to do something like (just for a simple example);

    <Grid> <Grid.Resources> <Style TargetType="Rectangle"> <Setter Property="Margin" Value="{StaticResource StandardizedMargin}"> <Setter Property="Fill" Value="{StaticResource StandardizedBrush}"> <Setter Property="Height" Value="{StaticResource StandardizedHeight}"> <Setter Property="Width" Value="{StaticResource StandardizedWidth}"> </Style> </Grid.Resources> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <!-- And many more rows --> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <!-- And many more columns --> </Grid.ColumnDefinitions> <Rectangle /> <Rectangle Grid.Column="1"/> <Rectangle Grid.Row="1"/> <Rectangle Grid.Row="1" Grid.Column="1"/>

    <!-- And many, many more rectangles --> </Grid>

    That way would throw the "Catastrophic" failure on each setter that calls a StaticResource. Do I instead suck it up and go apply those properties to each individual object (which does make the failure go away obviously, but doesn't do much to clean up my xaml?) Or do I ignore this "Catastrophic" failure because the VS designer is the only thing effected by it?

    Please mark answers as helpful when used, and answered when completed.

    Tuesday, September 11, 2012 7:09 PM