Popup:
- <StackPanel Grid.Column="0" Grid.Row="6" Orientation="Horizontal">
- <local:ImageButton x:Name="btn_back2" Margin="10,0,5,0" ImgPath="/Images/返回2.png" Width="112" Height="43" Template="{StaticResource ImageButtonTemplate}" Click="btn_back2_Click" />
- <local:ImageButton x:Name="btn_bg" Margin="5,0" ImgPath="/Images/背景.png" Width="82" Height="43" Template="{StaticResource ImageButtonTemplate}" Click="btn_bg_Click" />
- <local:ImageButton x:Name="btn_jiaojia" Margin="5,0" ImgPath="/Images/脚架.png" Width="82" Height="43" Template="{StaticResource ImageButtonTemplate}" Click="btn_jiaojia_Click" />
- <local:ImageButton x:Name="btn_xiangji" Margin="5,0" ImgPath="/Images/相机.png" Width="82" Height="43" Template="{StaticResource ImageButtonTemplate}" Click="btn_xiangji_Click" />
- </StackPanel>
- <Popup x:Name="Pop_bg" PopupAnimation="Fade" Width="88" Height="125" PlacementTarget="{Binding ElementName=btn_bg}" Placement="Top" AllowsTransparency="True" StaysOpen="False" IsOpen="False">
- <Border>
- <Border.Background>
- <ImageBrush ImageSource="/AutoCamera;component/Images/下拉背景.png" />
- </Border.Background>
- <StackPanel Margin="5">
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/上升.png" Margin="2,10" Template="{StaticResource ImageButtonTemplate}" />
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/下降.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- </StackPanel>
- </Border>
- </Popup>
- <Popup x:Name="Pop_jiaojia" PopupAnimation="Fade" Width="88" Height="125" PlacementTarget="{Binding ElementName=btn_jiaojia}" Placement="Top" AllowsTransparency="True" StaysOpen="False" IsOpen="False">
- <Border>
- <Border.Background>
- <ImageBrush ImageSource="/AutoCamera;component/Images/下拉背景.png" />
- </Border.Background>
- <StackPanel Margin="5">
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/上升.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/复位.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/下降.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- </StackPanel>
- </Border>
- </Popup>
- <Popup x:Name="Pop_xiangji" PopupAnimation="Fade" Width="88" Height="125" PlacementTarget="{Binding ElementName=btn_xiangji}" Placement="Top" AllowsTransparency="True" StaysOpen="False" IsOpen="False">
- <Border>
- <Border.Background>
- <ImageBrush ImageSource="/AutoCamera;component/Images/下拉背景.png" />
- </Border.Background>
- <StackPanel Margin="5">
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/上升.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/复位.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- <local:ImageButton Width="70" Height="31" ImgPath="/Images/下降.png" Margin="2" Template="{StaticResource ImageButtonTemplate}" />
- </StackPanel>
- </Border>
- </Popup>
截图:
弹出菜单:
MyResDic.xaml
- <ControlTemplate x:Key="SelfMenuItemTemplate" TargetType="{x:Type MenuItem}">
- <Border Background="Transparent" Height="25">
- <StackPanel Orientation="Horizontal">
- <Rectangle Width="5" Height="25" Name="mousemark" Fill="Gray" />
- <TextBlock Margin="5,0" VerticalAlignment="Center" Text="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}"/>
- </StackPanel>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="mousemark" Property="Fill" Value="Blue" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
MainWindow.xaml
- <local:ImageButton x:Name="btn_set" Width="27" Height="26" VerticalAlignment="Top" ImgPath="/Images/设置菜单.png" Template="{StaticResource ImageButtonTemplate}" Click="btn_set_Click">
- <local:ImageButton.ContextMenu>
- <ContextMenu Name="menu" Placement="MousePoint" Width="200">
- <MenuItem Header="修改密码" Template="{StaticResource SelfMenuItemTemplate}" />
- <MenuItem Header="设置照片存放位置" Template="{StaticResource SelfMenuItemTemplate}" />
- <MenuItem Header="设置套系解析位置" Template="{StaticResource SelfMenuItemTemplate}" />
- <MenuItem Header="进入官网" Template="{StaticResource SelfMenuItemTemplate}" />
- <ContextMenu.Template>
- <ControlTemplate TargetType="{x:Type ContextMenu}">
- <Border Margin="10,10" Background="AliceBlue">
- <ItemsPresenter Margin="2,2" />
- <Border.Effect>
- <DropShadowEffect BlurRadius="8" Opacity="0.5" />
- </Border.Effect>
- </Border>
- </ControlTemplate>
- </ContextMenu.Template>
- </ContextMenu>
- </local:ImageButton.ContextMenu>
- </local:ImageButton>
截图:
下面给大家欣赏下整个界面好了,请允许我小小的嘚瑟下~
工程下载地址(只实现了界面哦~):
http://yun.baidu.com/share/link?shareid=1484254303&uk=3508115909
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!