completed the missing code
This commit is contained in:
1 parent
aec26ea5be
commit
efa05191da
4 files changed
+19
-5
No files matched your search
@@ -71,6 +71,8 @@ namespace HandyControlDemo
|
||||
}
|
||||
|
||||
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
|
||||
ConfigHelper.Instance.SetWindowDefaultStyle();
|
||||
ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
|
||||
|
||||
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(SslProtocols)0x00000C00;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,19 @@ namespace HandyControl.Controls
|
||||
if (popup.TemplatedParent is MenuItem menuItem)
|
||||
{
|
||||
SetTopLine(menuItem, topLine);
|
||||
menuItem.Unloaded += MenuItem_Unloaded;
|
||||
}
|
||||
menuItem.Loaded += MenuItem_Loaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void MenuItem_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var menuItem = (FrameworkElement)sender;
|
||||
menuItem.Unloaded += MenuItem_Unloaded;
|
||||
var topLine = GetTopLine(menuItem);
|
||||
var popup = GetPopup(topLine);
|
||||
if (popup != null)
|
||||
{
|
||||
popup.Opened += Popup_Opened;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Effects.xaml"/>
|
||||
<ResourceDictionary Source="../ScrollViewer.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -11,7 +12,7 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ContextMenu">
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="2" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="2" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
|
||||
<ScrollViewer Style="{StaticResource ScrollViewerUpDown}" Margin="0,6">
|
||||
<ItemsPresenter/>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,3" x:Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<Path x:Name="Path" Grid.Column="4" Width="10" Height="10" HorizontalAlignment="Left" Data="{StaticResource RightGeometry}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" VerticalAlignment="Center"/>
|
||||
<Popup Grid.Column="1" x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" VerticalOffset="-13" HorizontalOffset="10">
|
||||
<Border CornerRadius="2" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
<Border Effect="{StaticResource EffectShadow2}" Margin="8" CornerRadius="2" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
<ScrollViewer Style="{StaticResource ScrollViewerUpDown}" Margin="0,6">
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
|
||||
</ScrollViewer>
|
||||
@@ -185,7 +185,7 @@
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".4"/>
|
||||
|
||||
Reference in new issue
Block a user