Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 使WPF应用程序看起来像Metro样式,即使在Windows7中也是如此?(窗口镀铬/主题/主题)_.net_Wpf_Windows 7_Windows 8_Microsoft Metro - Fatal编程技术网

.net 使WPF应用程序看起来像Metro样式,即使在Windows7中也是如此?(窗口镀铬/主题/主题)

.net 使WPF应用程序看起来像Metro样式,即使在Windows7中也是如此?(窗口镀铬/主题/主题),.net,wpf,windows-7,windows-8,microsoft-metro,.net,Wpf,Windows 7,Windows 8,Microsoft Metro,我喜欢新Office套件和Visual Studio上的Windows chrome: 当然,我仍在为Windows7开发应用程序,但我想知道是否有一种快速简便的方法(阅读:WPF样式或Windows库)来模拟这种样式。我以前做过一些window chrome的造型,但是要让它看起来和表现得恰到好处真的很棘手 < P>我最终选择的解决方案是(),(在使用两个软件之后),我认为是一个优秀的UI工具包(值得推荐)。 它只需很小的工作量即可对应用程序进行蒙皮,并对标准Windows8控件进行了修

我喜欢新Office套件和Visual Studio上的Windows chrome:

当然,我仍在为Windows7开发应用程序,但我想知道是否有一种快速简便的方法(阅读:WPF样式或Windows库)来模拟这种样式。我以前做过一些window chrome的造型,但是要让它看起来和表现得恰到好处真的很棘手


<是否有人知道是否有现有的模板或库向我的WPF应用程序添加“现代UI”的外观和感觉?< /P> < P>我最终选择的解决方案是(),(在使用两个软件之后),我认为是一个优秀的UI工具包(值得推荐)。

它只需很小的工作量即可对应用程序进行蒙皮,并对标准Windows8控件进行了修改。它很结实

Nuget上提供了一个版本:

您可以使用GUI通过Nuget安装MahApps.Metro(右键单击 您的项目、管理Nuget引用、搜索“MahApps.Metro”)或 通过控制台:

PM>安装包MahApps.Metro

它也是免费的,甚至用于商业用途

更新日期10-29-2013: 我发现Github版本的MahApps.Metro包含了当前nuget版本中无法提供的控件和样式,包括:

数据网格:

清洁窗户:

弹出按钮:

瓷砖:


github存储库非常活跃,有相当多的用户贡献。我建议你去看看

我所做的是创建自己的窗口和样式。因为我喜欢控制一切,我不想让一些外部库仅仅使用它的一个窗口。我看了已经提到的

而且也很好。(.仅限NET4.5)

还有一个,但我真的没试过这个

我做的风格很简单,当我看到它是如何在这些。现在我有了自己的窗口,我可以用xaml做任何我想做的事情。。。对我来说,这是我自己做的主要原因。我还为你做了一个:)我可能应该说,如果不探索现代UI我就无法做到这一点,这对我帮助很大。我试着让它看起来像VS2012窗口。看起来像这样

下面是代码(请注意它的目标是.NET4.5)

公共类MyWindow:Window
{
公共MyWindow()
{
添加(新的CommandBinding(SystemCommands.CloseWindowCommand,this.OnCloseWindow));
添加(新的CommandBinding(SystemCommands.MaximizeWindowCommand,this.OnMaximizeWindow,this.OnCanResizeWindow));
添加(新的CommandBinding(SystemCommands.MinimizeWindowCommand,this.OnMinimizeWindow,this.OnCanMinimizeWindow));
添加(新的CommandBinding(SystemCommands.RestoreWindowCommand,this.OnRestoreWindow,this.OnCanResizeWindow));
}
私有void OnCanResizeWindow(对象发送方,CanExecuteRoutedEventArgs e)
{
e、 CanExecute=this.ResizeMode==ResizeMode.CanResize | | this.ResizeMode==ResizeMode.CanResizeWithGrip;
}
私有void OnCanMinimizeWindow(对象发送方,CanExecuteRoutedEventArgs e)
{
e、 CanExecute=this.ResizeMode!=ResizeMode.NoResize;
}
私有void OnCloseWindow(对象目标,ExecutedRoutedEventTarget)
{
SystemCommands.CloseWindow(此);
}
MaximizeWindow上的私有void(对象目标,已执行路由目标)
{
SystemCommands.MaximizeWindow(此);
}
MinimizeWindow上的私有void(对象目标,ExecutedRoutedEventTargets e)
{
系统命令。最小化窗口(此);
}
RestoreWindow上的私有void(对象目标,ExecutedRoutedEventTargets e)
{
SystemCommands.RestoreWindow(这个);
}
}
以下是资源:


#FF2D2D30
#FF3F3F41
#FF007ACC
#FFF4
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" WindowChrome.IsHitTestVisibleInChrome="True" Grid.Row="0">
<Button Command="{Binding Source={x:Static SystemCommands.MinimizeWindowCommand}}" ToolTip="minimize" Style="{StaticResource WindowButtonStyle}">
    <Button.Content>
        <Grid Width="30" Height="25">
            <TextBlock Text="0" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="3.5,0,0,3" />
        </Grid>
    </Button.Content>
</Button>
<Grid Margin="1,0,1,0">
    <Button x:Name="Restore" Command="{Binding Source={x:Static SystemCommands.RestoreWindowCommand}}" ToolTip="restore" Visibility="Collapsed" Style="{StaticResource WindowButtonStyle}">
        <Button.Content>
            <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.Content>
    </Button>
    <Button x:Name="Maximize" Command="{Binding Source={x:Static SystemCommands.MaximizeWindowCommand}}" ToolTip="maximize" Style="{StaticResource WindowButtonStyle}">
        <Button.Content>
            <Grid Width="31" Height="25">
                <TextBlock Text="1" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="2,0,0,1" />
            </Grid>
        </Button.Content>
    </Button>
</Grid>
<Button Command="{Binding Source={x:Static SystemCommands.CloseWindowCommand}}" ToolTip="close"  Style="{StaticResource WindowButtonStyle}">
    <Button.Content>
        <Grid Width="30" Height="25">
            <TextBlock Text="r" FontFamily="Marlett" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="0,0,0,1" />
        </Grid>
    </Button.Content>
</Button>