IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Framework .NET Discussion :

[WPF] Problème de menu dans fenetre transparente


Sujet :

Framework .NET

  1. #1
    Futur Membre du Club
    Inscrit en
    Janvier 2008
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 14
    Points : 9
    Points
    9
    Par défaut [WPF] Problème de menu dans fenetre transparente
    Bonjour,

    J'utilise un Menu dans une fenetre ayant le flag AllowsTransparency activé. Le probleme est que le popup associé au MenuItem apparait en arrière plan.

    Comment faire pour forcer un popup à apparaitre au premier plan, pour contourner un pb qui viendrait de .NET 3.0

    Merci

    Zucher

    Code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
     
    <Window
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	x:Class="UntitledProject1.Window1"
    	x:Name="Window"
    	Title="Window1"
    	Width="200" Height="150" Background="{x:Null}" WindowStyle="None" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" AllowsTransparency="True">
     
    	<Window.Resources>
    		<Style x:Key="MenuStyle1" TargetType="{x:Type Menu}">
    			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}"/>
    			<Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
    			<Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
    			<Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
    			<Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
    			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
    			<Setter Property="VerticalContentAlignment" Value="Center"/>
    			<Setter Property="Template">
    				<Setter.Value>
    					<ControlTemplate TargetType="{x:Type Menu}">
    						<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="20,20,20,20">
    							<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
    						</Border>
    					</ControlTemplate>
    				</Setter.Value>
    			</Setter>
    		</Style>
    		<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
    			<WrapPanel IsItemsHost="True" Orientation="Vertical"/>
    		</ItemsPanelTemplate>
    		<PathGeometry x:Key="Checkmark" Figures="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z"/>
    		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    			<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
    				<Grid>
    					<Grid.ColumnDefinitions>
    						<ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="17" Width="Auto"/>
    						<ColumnDefinition Width="*"/>
    						<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
    						<ColumnDefinition Width="14"/>
    					</Grid.ColumnDefinitions>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
    					<Path Visibility="Hidden" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True"/>
    					<TextBlock Margin="5,2,0,2" x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" DockPanel.Dock="Right"/>
    				</Grid>
    			</Border>
    			<ControlTemplate.Triggers>
    				<Trigger Property="Icon" Value="{x:Null}">
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsChecked" Value="true">
    					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsHighlighted" Value="true">
    					<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
    				</Trigger>
    				<Trigger Property="IsEnabled" Value="false">
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    				</Trigger>
    			</ControlTemplate.Triggers>
    		</ControlTemplate>
    		<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
    		<Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
    			<Setter Property="ClickMode" Value="Hover"/>
    			<Setter Property="MinWidth" Value="0"/>
    			<Setter Property="MinHeight" Value="0"/>
    			<Setter Property="Template">
    				<Setter.Value>
    					<ControlTemplate TargetType="{x:Type RepeatButton}">
    						<DockPanel SnapsToDevicePixels="true" Background="Transparent">
    							<Rectangle x:Name="R1" Width="1" Fill="Transparent" DockPanel.Dock="Right"/>
    							<Rectangle x:Name="B1" Height="1" Fill="Transparent" DockPanel.Dock="Bottom"/>
    							<Rectangle x:Name="L1" Width="1" Fill="Transparent" DockPanel.Dock="Left"/>
    							<Rectangle x:Name="T1" Height="1" Fill="Transparent" DockPanel.Dock="Top"/>
    							<ContentPresenter HorizontalAlignment="Center" Margin="2,2,2,2" x:Name="ContentContainer" VerticalAlignment="Center"/>
    						</DockPanel>
    						<ControlTemplate.Triggers>
    							<Trigger Property="IsPressed" Value="true">
    								<Setter Property="Fill" TargetName="R1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
    								<Setter Property="Fill" TargetName="B1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
    								<Setter Property="Fill" TargetName="L1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    								<Setter Property="Fill" TargetName="T1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    								<Setter Property="Margin" TargetName="ContentContainer" Value="3,3,1,1"/>
    							</Trigger>
    						</ControlTemplate.Triggers>
    					</ControlTemplate>
    				</Setter.Value>
    			</Setter>
    		</Style>
    		<Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
    		<Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
    		<Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
    			<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
    			<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
    			<Setter Property="Template">
    				<Setter.Value>
    					<ControlTemplate TargetType="{x:Type ScrollViewer}">
    						<Grid SnapsToDevicePixels="true">
    							<Grid.ColumnDefinitions>
    								<ColumnDefinition Width="*"/>
    							</Grid.ColumnDefinitions>
    							<Grid.RowDefinitions>
    								<RowDefinition Height="Auto"/>
    								<RowDefinition Height="*"/>
    								<RowDefinition Height="Auto"/>
    							</Grid.RowDefinitions>
    							<Border Grid.Column="0" Grid.Row="1">
    								<ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
    							</Border>
    							<RepeatButton Focusable="false" Style="{StaticResource MenuScrollButton}" Grid.Column="0" Grid.Row="0" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
    								<RepeatButton.Visibility>
    									<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
    										<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
    										<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
    										<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    										<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    									</MultiBinding>
    								</RepeatButton.Visibility>
    								<Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource UpArrow}"/>
    							</RepeatButton>
    							<RepeatButton Focusable="false" Style="{StaticResource MenuScrollButton}" Grid.Column="0" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
    								<RepeatButton.Visibility>
    									<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
    										<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
    										<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
    										<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    										<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    									</MultiBinding>
    								</RepeatButton.Visibility>
    								<Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource DownArrow}"/>
    							</RepeatButton>
    						</Grid>
    					</ControlTemplate>
    				</Setter.Value>
    			</Setter>
    		</Style>
    		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    			<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
    				<DockPanel>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
    					<Path Visibility="Collapsed" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="Header" RecognizesAccessKey="True"/>
    					<Popup Focusable="false" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" x:Name="PART_Popup" AllowsTransparency="True">
    						<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
    							<Border x:Name="SubMenuBorder" Background="#FFF0F21B" BorderBrush="#FF99A0AC" BorderThickness="5,5,5,5" CornerRadius="10,10,10,10">
    								<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
    									<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
    								</ScrollViewer>
    							</Border>
    						</Microsoft_Windows_Themes:SystemDropShadowChrome>
    					</Popup>
    				</DockPanel>
    			</Border>
    			<ControlTemplate.Triggers>
    				<Trigger Property="IsSuspendingPopupAnimation" Value="true">
    					<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
    					<Setter Property="Margin" TargetName="SubMenuBorder" Value="0,0,0,0"/>
    					<Setter Property="Padding" TargetName="SubMenuBorder" Value="20,20,20,20"/>
    					<Setter Property="HorizontalOffset" TargetName="PART_Popup" Value="-40"/>
    				</Trigger>
    				<Trigger Property="Icon" Value="{x:Null}">
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsChecked" Value="true">
    					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsHighlighted" Value="true">
    					<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
    				</Trigger>
    				<Trigger Property="IsEnabled" Value="false">
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    				</Trigger>
    				<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
    					<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
    					<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
    				</Trigger>
    			</ControlTemplate.Triggers>
    		</ControlTemplate>
    		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    			<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
    				<DockPanel>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
    					<Path Visibility="Collapsed" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="Header" RecognizesAccessKey="True"/>
    				</DockPanel>
    			</Border>
    			<ControlTemplate.Triggers>
    				<Trigger Property="Icon" Value="{x:Null}">
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsChecked" Value="true">
    					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsHighlighted" Value="true">
    					<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
    				</Trigger>
    				<Trigger Property="IsEnabled" Value="false">
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    				</Trigger>
    			</ControlTemplate.Triggers>
    		</ControlTemplate>
    		<Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
    		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    			<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
    				<Grid>
    					<Grid.ColumnDefinitions>
    						<ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="17" Width="Auto"/>
    						<ColumnDefinition Width="*"/>
    						<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
    						<ColumnDefinition Width="14"/>
    					</Grid.ColumnDefinitions>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
    					<Path Visibility="Hidden" FlowDirection="LeftToRight" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource Checkmark}"/>
    					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True"/>
    					<Path Margin="4,0,6,0" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource RightArrow}" Grid.Column="3" DockPanel.Dock="Right"/>
    					<Popup Focusable="false" AllowsTransparency="true" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-3" x:Name="PART_Popup">
    						<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
    							<Border x:Name="SubMenuBorder" Background="{DynamicResource {x:Static SystemColors.MenuBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" BorderThickness="1">
    								<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
    									<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
    								</ScrollViewer>
    							</Border>
    						</Microsoft_Windows_Themes:SystemDropShadowChrome>
    					</Popup>
    				</Grid>
    			</Border>
    			<ControlTemplate.Triggers>
    				<Trigger Property="IsSuspendingPopupAnimation" Value="true">
    					<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
    				</Trigger>
    				<Trigger Property="Icon" Value="{x:Null}">
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="IsChecked" Value="true">
    					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
    					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    				</Trigger>
    				<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
    					<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
    					<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
    				</Trigger>
    				<Trigger Property="IsHighlighted" Value="true">
    					<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
    				</Trigger>
    				<Trigger Property="IsEnabled" Value="false">
    					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    				</Trigger>
    			</ControlTemplate.Triggers>
    		</ControlTemplate>
    		<Style x:Key="MenuItemStyle1" TargetType="{x:Type MenuItem}">
    			<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    			<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    			<Setter Property="Background" Value="Transparent"/>
    			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
    			<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    			<Style.Triggers>
    				<Trigger Property="Role" Value="TopLevelHeader">
    					<Setter Property="Margin" Value="0,1,0,1"/>
    					<Setter Property="Padding" Value="6,3,6,3"/>
    					<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    				</Trigger>
    				<Trigger Property="Role" Value="TopLevelItem">
    					<Setter Property="Margin" Value="0,1,0,1"/>
    					<Setter Property="Padding" Value="6,3,6,3"/>
    					<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    				</Trigger>
    				<Trigger Property="Role" Value="SubmenuHeader">
    					<Setter Property="DockPanel.Dock" Value="Top"/>
    					<Setter Property="Padding" Value="0,2,0,2"/>
    					<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    				</Trigger>
    				<Trigger Property="Role" Value="SubmenuItem">
    					<Setter Property="DockPanel.Dock" Value="Top"/>
    					<Setter Property="Padding" Value="0,2,0,2"/>
    				</Trigger>
    			</Style.Triggers>
    		</Style>
    	</Window.Resources>
     
    	<Grid x:Name="LayoutRoot">
    		<Menu ItemsPanel="{DynamicResource ItemsPanelTemplate1}" Background="#FF68F04E" Style="{DynamicResource MenuStyle1}">
    			<MenuItem Style="{DynamicResource MenuItemStyle1}" Header="MenuItem">
    				<MenuItem Header="MenuItem"/>
    				<MenuItem Header="MenuItem"/>
    			</MenuItem>
    			<MenuItem Header="MenuItem"/>
    			<MenuItem Header="MenuItem"/>
    		</Menu>
    	</Grid>
    </Window>

  2. #2
    Rédacteur
    Avatar de Thomas Lebrun
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    9 161
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 9 161
    Points : 19 434
    Points
    19 434
    Par défaut
    En changeant le ZIndex ?

  3. #3
    Futur Membre du Club
    Inscrit en
    Janvier 2008
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 14
    Points : 9
    Points
    9
    Par défaut
    Le Zindex n'est disponible que sur le submenuborder, mais pas sur le Popup lui même. une modification du zindex sur le Border n'a pas d'effet.

    ce qui est le plus étonnant, c'est que sur certaines machines le popup est au premier plan et que sur d'autre il y a le problème.

  4. #4
    Futur Membre du Club
    Inscrit en
    Janvier 2008
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 14
    Points : 9
    Points
    9
    Par défaut
    J'ai trouvé une alternative, en utilisant le flag Topmost sur la fenetre principale, ce qui ne me gene pas dans mon cas car je souhaite realiser un toaster dans ke systray, par contre cela devient un reel souci dans les autres cas

    Merci

    Zucher

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 0
    Dernier message: 30/06/2009, 21h41
  2. [WPF] Problème de WrapPanel dans un ItemsControl
    Par Asarnil dans le forum Windows Presentation Foundation
    Réponses: 4
    Dernier message: 03/03/2009, 09h03
  3. problème composant Menu dans un swf
    Par snipon dans le forum Flash/Flex
    Réponses: 0
    Dernier message: 24/02/2009, 13h55
  4. [WPF] Probléme de binding dans un UserControl :(
    Par UNi[FR] dans le forum Windows Presentation Foundation
    Réponses: 6
    Dernier message: 17/07/2008, 15h51
  5. WPF : Problème pour créer une fenetre parent/enfant simple
    Par Ranx62 dans le forum Windows Presentation Foundation
    Réponses: 2
    Dernier message: 01/04/2008, 02h39

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo