双击wpf的边框 [英] double click on border of wpf

查看:91
本文介绍了双击wpf的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

wpf的边框上有一个网格.我想在网格上双击以调整wpf窗口的大小. xaml代码如下:

There is a grid on border of wpf.I want to resize the wpf window on double click on grid. xaml code below:

<Grid Name="maxMinCloseGrid" Height="50"   ClipToBounds="False"  IsHitTestVisible="True">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition  Width=".300*" />
                                    <ColumnDefinition Width=".700*" />
                                </Grid.ColumnDefinitions>
                                <Label Margin="105,5,0,1" Name="titleLabel" DockPanel.Dock="Top"

                                    Background="Transparent" ClipToBounds="False" Foreground="{DynamicResource MyDarkBlueSolidBrush}" FontFamily="Tahoma"

                                    Grid.Column="1" HorizontalAlignment="Left" Width="185" FontSize="14" FontStyle="Normal"

                                     >OMNIKEY Workbench
                                </Label>
                                <Button  Name="closeButton" Margin="0,0,2,15" Click="closeButtonClick" Width="25"  Height="20"

                                TextBlock.FontWeight="Bold" Background="Transparent" BorderBrush="Transparent" Foreground="{DynamicResource MyDarkBlueSolidBrush}"

                                    HorizontalAlignment="Right" Grid.Column="1" BorderThickness="0" FontFamily="Webdings">
                                    r
                                </Button>
                                <Button Margin="0,0,26,15" Click="maximizeButtonClick"    Grid.Column="1" BorderThickness="0"  Focusable="False"  HorizontalAlignment="Right" VerticalAlignment="Center">
                               </Button>
                                <Button Name="minimizeButton" Margin="0,0,50,15" TextBlock.FontWeight="Bold" Foreground="{DynamicResource MyDarkBlueSolidBrush}"

                       Background="Transparent" BorderBrush="Transparent" BorderThickness="0"  Width="25" Height="20" FontWeight="Bold"

                               HorizontalAlignment="Right" Click="minimizeButtonClick" Grid.Column="1" FontSize="11" Focusable="False" Content="0" FontFamily="Webdings">
                                </Button>
                            </Grid>

推荐答案

我建​​议您至少不要直接这样做.相反,我建议您使用缩略图 [
I suggest you don''t do that, directly at least. Instead I suggest you use Thumb[^] instead and subscribe to the MouseDoubleClick event


这篇关于双击wpf的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆