Mahapps Metro Framework を使用した小さなアプリケーションがあります。接続/切断アイコンのように、タイトルバーのアイコンを変更したいと思います。コンテンツにアクセスしたり、動的にバインドするにはどうすればよいですか?
これは私のXAMLです:
<Controls:MetroWindow x:Class="NFCAgent.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
Title="NFC-Agent"
Height="55"
Width="250"
ResizeMode="NoResize"
GlowBrush="{DynamicResource AccentColorBrush}"
WindowStartupLocation="Manual"
Topmost="True"
ShowIconOnTitleBar="True">
<Controls:MetroWindow.LeftWindowCommands>
<Controls:WindowCommands>
<Button IsEnabled="False" >
<StackPanel Orientation="Horizontal">
<Rectangle x:Name="headerLogo" Width="20" Height="20"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Fill"
Visual="{DynamicResource appbar_cupcake}" />
</Rectangle.OpacityMask>
</Rectangle>
</StackPanel>
</Button>
</Controls:WindowCommands>
</Controls:MetroWindow.LeftWindowCommands>
<Grid>
<StackPanel Orientation="Horizontal">
<Rectangle Width="25" Height="25" Margin="4 0">
<Rectangle.Fill>
<VisualBrush Visual="{DynamicRessource appbar_add}" />
</Rectangle.Fill>
</Rectangle>
<TextBlock x:Name="txtStatus" Text="Statusinfo" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Grid>
追加: ImageFile はありません (*.ico はありません)。Mahapps.Resources (xaml-Files) に含まれるリソースを使用します。Afaik Rectangle の内容を何らかの方法で置き換える必要がありますが、どうすればよいでしょうか?

