3.5の.NETFrameworkを使用するVisualStudioWPF2008プロジェクトにWPFを使用しています。私はWPFと、特にユーザーインターフェイスを設計しようとしているExpressionBlend3の両方に不慣れです。メインウィンドウに2色のグラデーションの背景を定義しました。メニュー定義がない場合は、次のXAMLコードで適切に表示されます。
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="XYZZY.MainWindow"
x:Name="Window"
Title="XYZZY Lobby" HorizontalAlignment="Center"
Width="796" Height="480" mc:Ignorable="d">
<Window.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF434D7A" Offset="0"/>
<GradientStop Color="#FF180CFA" Offset="1"/>
</LinearGradientBrush>
</Window.Background>
<Grid x:Name="LayoutRoot" Width="764">
<Path Fill="Black" Stretch="Fill" Stroke="Black" HorizontalAlignment="Left" Margin="-227,0,0,184" VerticalAlignment="Bottom" Width="1" Height="1" Data="M-227,256"/>
<ListView HorizontalAlignment="Left" Width="239" Margin="0,148,0,45">
<ListView.View>
<GridView>
<GridViewColumn Width="90" Header="Game" />
<GridViewColumn Width="60" Header="Stakes" />
<GridViewColumn Width="35" Header="Seats" />
</GridView>
</ListView.View>
</ListView>
<ListView Margin="239,148,218,45">
<ListView.View>
<GridView>
<GridViewColumn Width="90" Header="Table" />
<GridViewColumn Width="15" Header="Players" />
<GridViewColumn Width="60" Header="Buy-in" />
<GridViewColumn Width="50" Header="Speed" />
<GridViewColumn Width="25" Header="H/Hr" />
<GridViewColumn Width="35" Header="Avg Pot" />
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
<ListView Margin="546,148,0,45">
<ListView.View>
<GridView>
<GridViewColumn Width="90" Header="Player" />
<GridViewColumn Width="60" Header="City" />
<GridViewColumn Width="35" Header="Chips" />
</GridView>
</ListView.View>
</ListView>
<TextBlock x:Name="LobbyServerLabel" HorizontalAlignment="Left" VerticalAlignment="Bottom" TextWrapping="Wrap" Text="Lobby Server - not connected"/>
<TextBlock x:Name="GameServerLabel" HorizontalAlignment="Center" VerticalAlignment="Bottom" TextWrapping="Wrap"><Run Text="Game Server - not connected"/></TextBlock>
<Label x:Name="SkinName1" Margin="8,54,0,0" VerticalAlignment="Top" Content="XYZZY" FontSize="36" Foreground="#FFD23C32" HorizontalAlignment="Left" FontFamily="Georgia" FontWeight="Bold"/>
<Label x:Name="SkinName2" Margin="182.405,54,459,0" VerticalAlignment="Top" Content="A A" FontSize="36" Foreground="#FFD23C32" FontFamily="Georgia" FontWeight="Bold"/>
<Image VerticalAlignment="Top" Width="41.81" Height="51.519" Source="Spade1.png" Stretch="Fill" Margin="136.595,53.384,585.595,0"/>
</Grid>
</Window>
しかし、メニューを追加すると、メニューの背景色がウィンドウの他の部分の背景色を引き継ぐように見えます。メニュー定義と同じコードを次に示します。
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="AttackPoker2.MainWindow"
x:Name="Window"
Title="Attack Poker Lobby" HorizontalAlignment="Center"
Width="796" Height="480" mc:Ignorable="d">
<Window.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF434D7A" Offset="0"/>
<GradientStop Color="#FF180CFA" Offset="1"/>
</LinearGradientBrush>
</Window.Background>
<Grid x:Name="LayoutRoot" Width="764">
<Path Fill="Black" Stretch="Fill" Stroke="Black" HorizontalAlignment="Left" Margin="-227,0,0,184" VerticalAlignment="Bottom" Width="1" Height="1" Data="M-227,256"/>
<Menu>
<MenuItem Header="File">
<MenuItem Header="New"></MenuItem>
<MenuItem Header="Open"></MenuItem>
<MenuItem Header="Save"></MenuItem>
<Separator></Separator>
<MenuItem Header="Exit"></MenuItem>
</MenuItem>
<MenuItem Header="Edit">
<MenuItem Header="Undo"></MenuItem>
<MenuItem Header="Redo"></MenuItem>
<Separator>
<Separator.Template>
<ControlTemplate>
<Border CornerRadius="2" Padding="5" BorderBrush="Black" BorderThickness="1" Background="PaleGoldenrod">
<TextBlock FontWeight="Bold">
Editing Commands
</TextBlock>
</Border>
</ControlTemplate>
</Separator.Template>
</Separator>
<MenuItem Header="Cut"></MenuItem>
<MenuItem Header="Copy"></MenuItem>
<MenuItem Header="Paste"></MenuItem>
</MenuItem>
</Menu>
<ListView HorizontalAlignment="Left" Width="239" Margin="0,148,0,45">
<ListView.View>
<GridView>
<GridViewColumn Width="90" Header="Game" />
<GridViewColumn Width="60" Header="Stakes" />
<GridViewColumn Width="35" Header="Seats" />
</GridView>
</ListView.View>
</ListView>
<ListView Margin="239,148,218,45">
<ListView.View>
<GridView>
<GridViewColumn Width="90" Header="Table" />
<GridViewColumn Width="15" Header="Players" />
<GridViewColumn Width="60" Header="Buy-in" />
<GridViewColumn Width="50" Header="Speed" />
<GridViewColumn Width="25" Header="H/Hr" />
<GridViewColumn Width="35" Header="Avg Pot" />
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
<ListView Margin="546,148,0,45">
<ListView.View>
<GridView>
<GridViewColumn Width="90" Header="Player" />
<GridViewColumn Width="60" Header="City" />
<GridViewColumn Width="35" Header="Chips" />
</GridView>
</ListView.View>
</ListView>
<TextBlock x:Name="LobbyServerLabel" HorizontalAlignment="Left" VerticalAlignment="Bottom" TextWrapping="Wrap" Text="Lobby Server - not connected"/>
<TextBlock x:Name="GameServerLabel" HorizontalAlignment="Center" VerticalAlignment="Bottom" TextWrapping="Wrap"><Run Text="Game Server - not connected"/></TextBlock>
<Label x:Name="SkinName1" Margin="8,54,0,0" VerticalAlignment="Top" Content="Attack" FontSize="36" Foreground="#FFD23C32" HorizontalAlignment="Left" FontFamily="Georgia" FontWeight="Bold"/>
<Label x:Name="SkinName2" Margin="182.405,54,459,0" VerticalAlignment="Top" Content="Poker" FontSize="36" Foreground="#FFD23C32" FontFamily="Georgia" FontWeight="Bold"/>
<Image VerticalAlignment="Top" Width="41.81" Height="51.519" Source="Spade1.png" Stretch="Fill" Margin="136.595,53.384,585.595,0"/>
</Grid>
</Window>
メニュー定義を移動してみましたが、役に立ちません。誰かがExpressionBlend3またはC#コードで指定して、メニューの背景色をメニューだけに適用し、他には適用しないようにする方法を説明できますか?