XBAPではBitmapEffectが使えない
こちらの小野さんのblogで知りましたが、下記のblogでスタンドアロンのWPFアプリケーションとXAMLブラウザアプリケーション(XBAP)の違いが紹介されています。
Comparing WPF applications and XBAP – What’s the difference? | WPF Wonderland
XBAPはコードアクセスセキュリティ(CAS)によりセキュリティサンドボックス上で実行されるため、いくつかの制限があります。WCFが使えないというのは結構有名な話なので知っていましたが、BitmapEffectが使えないというのは知りませんでした。
ということで、実際にどうなるのか試してみました。
XAML
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WindowsApplication1" Height="300" Width="300"
FontSize="24"
>
<StackPanel>
<Button Margin="20" VerticalAlignment="Top">
BitmapEffect 無し
</Button>
<Button Margin="20" VerticalAlignment="Top">
BevelBitmapEffect
<Button.BitmapEffect>
<BevelBitmapEffect/>
</Button.BitmapEffect>
</Button>
</StackPanel>
</Window>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WindowsApplication1" Height="300" Width="300"
FontSize="24"
>
<StackPanel>
<Button Margin="20" VerticalAlignment="Top">
BitmapEffect 無し
</Button>
<Button Margin="20" VerticalAlignment="Top">
BevelBitmapEffect
<Button.BitmapEffect>
<BevelBitmapEffect/>
</Button.BitmapEffect>
</Button>
</StackPanel>
</Window>
上が普通のボタンで、下がBevelBitmapEffectをかけたボタンです。
これを単純にXBAPでも同じように記述して、実行してみた結果が下記の画面です。
BevelBitmapEffectが適用されていないことが確認できます。エラーなどになるわけではなく、単純に適用されないというだけのようですね。