Open Hakoyu opened 1 year ago
菜单显示在右边时
菜单显示在左边时
可以看到有很大程度的偏移 因为将pu:ContextMenuHelper.ItemsWidth设置为了NaN根据字符串长度来改变菜单长度 但是没有完全改变菜单的实际长度(鼠标和菜单间隔的这一段依旧是菜单的一部分,只是看不到了而已)
pu:ContextMenuHelper.ItemsWidth
NaN
<Style x:Key="ContextMenu_Style" BasedOn="{StaticResource {x:Type ContextMenu}}" TargetType="ContextMenu"> <Setter Property="Background" Value="{DynamicResource ColorBG}" /> <Setter Property="BorderBrush" Value="{DynamicResource ColorLight3}" /> <Setter Property="Foreground" Value="{DynamicResource ColorFG}" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Width" Value="NaN" /> <Setter Property="pu:ShadowHelper.ShadowDepth" Value="3" /> <Setter Property="pu:ContextMenuHelper.ShadowColor" Value="{DynamicResource ColorAqua}" /> <Setter Property="pu:ContextMenuHelper.ItemsWidth" Value="NaN" /> <!--<Setter Property="pu:ContextMenuHelper.ItemsIconWidth" Value="0"/>--> <Setter Property="pu:ContextMenuHelper.ItemsHoverBackground" Value="{DynamicResource ColorLight2}" /> <Setter Property="pu:ContextMenuHelper.ItemsCheckedBackground" Value="{DynamicResource ColorLightBlue2}" /> <Setter Property="pu:ToolTipHelper.Background" Value="{DynamicResource ColorBG}" /> <Setter Property="pu:ToolTipHelper.Foreground" Value="{DynamicResource ColorFG}" /> <Setter Property="pu:ToolTipHelper.ShadowColor" Value="{DynamicResource ColorAqua}" /> </Style>
菜单显示在右边时
菜单显示在左边时
可以看到有很大程度的偏移 因为将
pu:ContextMenuHelper.ItemsWidth
设置为了NaN
根据字符串长度来改变菜单长度 但是没有完全改变菜单的实际长度(鼠标和菜单间隔的这一段依旧是菜单的一部分,只是看不到了而已)