Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

右键菜单显示在鼠标左侧时位置偏移的问题 #4

Open
Hakoyu opened this issue Dec 18, 2022 · 0 comments
Open

右键菜单显示在鼠标左侧时位置偏移的问题 #4

Hakoyu opened this issue Dec 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Hakoyu
Copy link
Owner

Hakoyu commented Dec 18, 2022

菜单显示在右边时
image

菜单显示在左边时
image

可以看到有很大程度的偏移
因为将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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant