views:

36

answers:

1

I was using the following xaml in wpf:

<Style TargetType="{x:Type Border}">
  <Setter Property="BitmapEffect">
 <Setter.Value>
  <BitmapEffectGroup>
   <DropShadowBitmapEffect ShadowDepth="1"/>
  </BitmapEffectGroup>
 </Setter.Value>
  </Setter> 
</Style>

When I discovered that DropShadowBitmapEffect is now deprecated in favour of DropShadowEffect:

<Style TargetType="{x:Type Border}">
    <Setter Property="Effect">
     <Setter.Value>
      <DropShadowEffect></DropShadowEffect>
     </Setter.Value>
    </Setter>
</Style>

But I know this in a lucky way!! How can I know that a certain control written in xaml is now deprecated??

+2  A: 

A good static analysis tool should be able to tell you when you use something that's been deprecated. In some cases the C# compiler will tell you. In fact, in this case, both R# and the C# compiler will pick up on the fact that you're using a property marked as Obsolete, if you assign it in C# code.

Unfortunately, at this time, it doesn't seem that either the R# static analysis process or the XAML compiler will pick up on if you use obsolete properties or elements in XAML. However, it does appear that the intellisense feature in R# will strikeout items that are deprecated, even when editing XAML.

I'd definitely check out fxcop to see if it'll work with XAML and see if there's a rule to check for usage of Obsolete members.

Edit:

R# (or Resharper) is a helpful plugin for Visual Studio that gives a lot of cool features including some in-editor static analysis.

dustyburwell
sorry for my ignorance... but what is R#?
Ricibald
oh, I apologize. R# = Resharper
dustyburwell