久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

WPF 透明菜單

WPF Transparent menu(WPF 透明菜單)
本文介紹了WPF 透明菜單的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我目前有以下菜單:

        <Menu Grid.Row="1" Margin="3" Background="Transparent">
        <MenuItem Name="mnuFile" Header="File" Background="#28FFAE04" Foreground="#FFFED528">
            <MenuItem Name="mnuSettings" Header="Settings" Background="#28FFAE04" Foreground="#FFFED528" />
            <MenuItem Name="mnuExit" Header="Exit" Background="#28FFAE04" Foreground="#FFFED528" />
        </MenuItem>
        <MenuItem Name="mnuView" Header="View" Background="#28FFAE04" Foreground="#FFFED528" />
        <MenuItem Name="mnuAbout" Header="About" Background="#28FFAE04" Foreground="#FFFED528"  />
    </Menu>

我不知道如何使下落的部分變成半透明或完全透明的類似于浮動文本.這樣我就可以看到下面的表格了.

I cannot figure out how to make the part that drops down semi-transparent or completely transparent resembling floating text. So that I can see the form underneath.

任何幫助將不勝感激.謝謝!

Any help would be appreciated. Thanks!

推薦答案

為此,您需要更改 MenuItem 模板.實現您想要的最簡單的模板更改是這樣的:

To do that, you'll need to change your MenuItem template. The simplest template change that achieves what you want is something like this:

  <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
    <Border Name="Border" >
      <Grid>
        <ContentPresenter 
          Margin="6,3,6,3" 
          ContentSource="Header"
          RecognizesAccessKey="True" />
        <Popup 
          Name="Popup"
          Placement="Bottom"
          IsOpen="{TemplateBinding IsSubmenuOpen}"
          AllowsTransparency="True" 
          Focusable="False"
          PopupAnimation="Fade">
          <Border 
            Name="SubmenuBorder"
            SnapsToDevicePixels="True"
            Background="Transparent">
            <StackPanel  
              IsItemsHost="True" 
              KeyboardNavigation.DirectionalNavigation="Cycle" />
          </Border>
        </Popup>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsSuspendingPopupAnimation" Value="true">
        <Setter TargetName="Popup" Property="PopupAnimation" Value="None"/>
      </Trigger>
      <Trigger Property="IsHighlighted" Value="true">
        <Setter TargetName="Border" Property="Background" Value="#C0C0C0"/>
        <Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
      </Trigger>
      <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
        <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,0,4,4"/>
        <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,3"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="#888888"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

要進行更多自定義,我建議使用 Blend 來編輯您的樣式/模板或使用 Kaxaml 的簡單樣式作為您樣式的起點.

For more customization, I'd recommend using Blend to edit your styles/templates or using Kaxaml's Simple Styles as a starting point for your styles.

這篇關于WPF 透明菜單的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

LINQ to SQL and Concurrency Issues(LINQ to SQL 和并發問題)
Yield return from a try/catch block(try/catch 塊的收益回報)
Should I call Parameters.Clear when reusing a SqlCommand with a transation?(重用帶有事務的 SqlCommand 時,我應該調用 Parameters.Clear 嗎?)
what does a using statement without variable do when disposing?(處理時不帶變量的 using 語句有什么作用?)
Why doesn#39;t TransactionScope work with Entity Framework?(為什么 TransactionScope 不適用于實體框架?)
How to dispose TransactionScope in cancelable async/await?(如何在可取消的 async/await 中處理 TransactionScope?)
主站蜘蛛池模板: 午夜久久久 | 色婷婷精品久久二区二区蜜臂av | 97久久精品午夜一区二区 | 男人影音| 精品婷婷 | 中文在线视频 | 国内精品久久久久久影视8 最新黄色在线观看 | 九九热最新地址 | 日韩午夜网站 | 好姑娘高清在线观看电影 | 国产真实乱对白精彩久久小说 | 天天干天天干 | 91玖玖 | 天堂免费 | 亚洲人a| 男人天堂视频在线观看 | 毛片毛片毛片毛片毛片 | 亚洲一区 中文字幕 | 日韩在线大片 | 亚洲欧洲成人 | 一区二区日韩 | v片网站 | 亚洲精品在线免费 | 狠狠影院| 久久精品无码一区二区三区 | 91麻豆精品国产91久久久更新资源速度超快 | 香蕉视频1024 | 国产亚洲精品精品国产亚洲综合 | 精品九九在线 | 99亚洲精品| 亚洲一区二区三区免费观看 | 日日av| 久久国产综合 | 成人在线免费观看 | 天天搞天天操 | 午夜午夜精品一区二区三区文 | 涩涩视频在线看 | 午夜三区 | 国产精品视频免费观看 | 色综合天天综合网国产成人网 | 免费国产一区 |