WPF网框架3.5窗口Metro风格 [英] WPF Net Framework 3.5 Window Metro Style

查看:603
本文介绍了WPF网框架3.5窗口Metro风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使窗口的Metro风格。


我发现了以下3个库:

http://elysium.asvishnyakov.com/en/

https://github.com/MahApps/MahApps.Metro

HTTP://mui.$c$cplex.com/

所有对.Net框架4+。
有什么3.5?

我也试图让我自己(Didnt完成 - 仍需要设计,并添加调整大小[我不知道该怎么]),但我真的不喜欢它是如何做...:

 <窗​​口
        的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
        的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
        的xmlns:xctk =htt​​p://schemas.xceed.com/wpf/xaml/tool​​kitX:类=Windows_Hider.MainWindow
        标题=视窗藏起来高度=350宽度=525WindowStartupLocation =中心屏幕
        AllowsTransparency =真
    ResizeMode =CanResizeWindowStyle =为无BorderBrush =黑了borderThickness =1图标=windowshider.ico>
    <电网>
        <电网>
            < Grid.RowDefinitions>
                < RowDefinition高度=自动/>
                < RowDefinition身高=*/>
            < /Grid.RowDefinitions>
            < StackPanel的方向=横向的Horizo​​ntalAlignment =左VerticalAlignment =热门>
                <图像宽度=24高度=24来源={绑定图标,的RelativeSource = {的RelativeSource FindAncestor,AncestorType = {X:类型窗口}}}/>
                <标签VerticalAlignment =中心字号=14CONTENT ={结合标题,的RelativeSource = {的RelativeSource FindAncestor,AncestorType = {X:类型窗口}}}/>
            < / StackPanel的>
            <电网的MouseDown =Grid_MouseDown背景=透明/>
            < StackPanel的方向=横向的Horizo​​ntalAlignment =右VerticalAlignment =热门Grid.Row =0>
                <按钮工具提示=最小化背景=白>
                    <电网WIDTH =30高度=25>
                        < TextBlock的文本=0的FontFamily =Marlett字号=14VerticalAlignment =中心的Horizo​​ntalAlignment =中心填充=3.5,0,0,3/>
                    < /网格>
                < /按钮>
                <电网保证金=1,0,1,0>
                    <按钮X:名称=恢复工具提示=恢复能见度=折叠>
                        <电网WIDTH =30高度=25UseLayoutRounding =真>
                            < TextBlock的文本=2的FontFamily =Marlett字号=14VerticalAlignment =中心的Horizo​​ntalAlignment =中心填充=2,0,0,1/>
                        < /网格>
                    < /按钮>
                    <按钮X:名称=最大化工具提示=最大化>
                        <电网WIDTH =31高度=25>
                            < TextBlock的文本=1的FontFamily =Marlett字号=14VerticalAlignment =中心的Horizo​​ntalAlignment =中心填充=2,0,0,1/>
                        < /网格>
                    < /按钮>
                < /网格>
                <按钮X:名称=关闭工具提示=关闭>
                    <电网WIDTH =30高度=25>
                        < TextBlock的文本=R的FontFamily =Marlett字号=14VerticalAlignment =中心的Horizo​​ntalAlignment =中心填充=0,0,0,1/>
                    < /网格>
                < /按钮>
            < / StackPanel的>
        < /网格>
    < /网格>
< /窗>
 

解决方案

好了,我花了几天,但最终我成功地做一些事情。

我不得不自己,因为没有地铁窗口的.Net框架3.5。

使它

我结合下面的一些参考:

<一个href="http://stackoverflow.com/questions/19410121/launch-windows-system-menu-on-custom-window">Launch在自定义窗口窗口的系统菜单

http://www.$c$cproject.com/Articles/107994/Taskbar-with-Window-Maximized-and-WindowState-to-N

HTTP:/ /blog.magnusmontin.net/2013/03/16/how-to-create-a-custom-window-in-wpf/

http://$c$ckong.word$p$pss.com/2010/11/10/custom-window-style-and-accounting-for-the-taskbar/

<一个href="http://blog.creativeitp.com/posts-and-articles/c-sharp/simple-methods-to-drag-and-resize-your-c-transparent-wpf-application-with-the-windowstyle-property-set-to-none/" rel="nofollow">http://blog.creativeitp.com/posts-and-articles/c-sharp/simple-methods-to-drag-and-resize-your-c-transparent-wpf-application-with-the-windowstyle-property-set-to-none/



这是

最终解决方案

已知问题/错误:
1.调整箭头光标出现在调整光标代替。
2.设计师不能显示自定义窗口。
3.最大化,随机有屏幕大面积的蓝色(的边框的颜色) - 的瞬间

如果你能解决它的任何上述问题会更好,但我很满意我所实现的。

编辑:
更新,允许调整大小模式(也加样品)

I want to make Window with Metro style.


I found the 3 following libraries:

http://elysium.asvishnyakov.com/en/

https://github.com/MahApps/MahApps.Metro

http://mui.codeplex.com/

All are for Net Framework 4+.
Is there anything for 3.5?

I also tried to make it on my own (Didnt finish - still need to design it and add Resize [which I dont know how]) but I dont really like how it's made...:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" x:Class="Windows_Hider.MainWindow"
        Title="Windows Hider" Height="350" Width="525" WindowStartupLocation="CenterScreen" 
        AllowsTransparency="True"
    ResizeMode="CanResize" WindowStyle="None" BorderBrush="Black" BorderThickness="1" Icon="windowshider.ico">
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top">
                <Image Width="24" Height="24" Source="{Binding Icon, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
                <Label VerticalAlignment="Center" FontSize="14" Content="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
            </StackPanel>
            <Grid MouseDown="Grid_MouseDown" Background="Transparent"/>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Row="0">
                <Button ToolTip="minimize" Background="White">
                    <Grid Width="30" Height="25">
                        <TextBlock Text="0" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="3.5,0,0,3" />
                    </Grid>
                </Button>
                <Grid Margin="1,0,1,0">
                    <Button x:Name="Restore"  ToolTip="restore" Visibility="Collapsed">
                        <Grid Width="30" Height="25" UseLayoutRounding="True">
                            <TextBlock Text="2" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="2,0,0,1" />
                        </Grid>
                    </Button>
                    <Button x:Name="Maximize" ToolTip="maximize">
                        <Grid Width="31" Height="25">
                            <TextBlock Text="1" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="2,0,0,1" />
                        </Grid>
                    </Button>
                </Grid>
                <Button  x:Name="Close" ToolTip="close">
                    <Grid Width="30" Height="25">
                        <TextBlock Text="r" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="0,0,0,1" />
                    </Grid>
                </Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>

解决方案

Ok, it took me few days but in the end I managed to do something.

I had to make it by myself because there's no Metro Window for Net Framework 3.5.

I combined some of the references below:

Launch window's System Menu on custom window

http://www.codeproject.com/Articles/107994/Taskbar-with-Window-Maximized-and-WindowState-to-N

http://blog.magnusmontin.net/2013/03/16/how-to-create-a-custom-window-in-wpf/

http://codekong.wordpress.com/2010/11/10/custom-window-style-and-accounting-for-the-taskbar/

http://blog.creativeitp.com/posts-and-articles/c-sharp/simple-methods-to-drag-and-resize-your-c-transparent-wpf-application-with-the-windowstyle-property-set-to-none/



this is the final solution

Known problems / bugs:
1. When resizing the arrow cursor appear instead of the resizing cursor.
2. Designer cant display the custom window.
3. When maximizing, randomly there's blue (the color of the borders) in big area of the screen - for split second

If you can fix any of the problems above it will be even better but I am satisfied with what I achieved.

EDIT:
Updated to allow resize modes (also added sample)

这篇关于WPF网框架3.5窗口Metro风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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