Window.AllowsTransparency, XamlDebuggingInformation, WPF

AllowsTransparency

laurenlavoieのブログで参照されているように、Windows Presentation Foundation (WPF) では、Windows.AllowsTransparencyプロパティを使って、ウィンドウの背景を透明にすることができます。実はJune CTPでやっと動作するようになりました。次のように記述します。

<Window x:Class="WindowTransparency.Window1"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    Title="WindowTransparency" Height="300" Width="300"
    AllowsTransparency="True" WindowStyle="None"
    Background="Transparent"
    >
  <Border CornerRadius="50" Background="Blue" Opacity=".7">
    <Button Click="CloseWindow" Height="30" Width="100">Close Me
    </Button>
  </Border>
</Window>

以前紹介したDesktop Window Managerによるぼかしつきの半透明とは違うことに注意してください。したがってXPでも動作しますが、ピクセル単位のぼかしのような効果はありません。Windows Media Playerのようにスキンを使いたいときや、非矩形のウィンドウを作成したいときに使うものです。

 

XamlDebuggingInformation

これもNick Kramerのブログで紹介されていますが、実行時エラーのXAMLの行数をメッセージに表示させることができるようになりました。.csproj や.vsproj内のプロジェクトファイルのPropertyGroupタグの下に以下の行を追加するだけです。

<XamlDebuggingInformation>true</XamlDebuggingInformation>