没有了“WPF丝带应用”项目模板 [英] No project template for a ‘WPF Ribbon Application’
问题描述
我是无法得到一个WPF功能区项目在Visual Studio中显示。 <一href="http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/019837dd-d439-4028-9acb-924f9588d2de/">Here是一个链接到一个线程有人在Visual Studio 2010中有一个问题。
I am unable to get a WPF Ribbon project to show in Visual Studio. Here is a link to a thread for someone that had an issue in Visual Studio 2010.
我已经试过各种建议有,但都无济于事。
I have tried everything suggested there but to no avail.
我的Visual Studio 2012例preSS已安装的桌面,但什么也没有显示出来。我试图卸载并重新安装,但没有运气。
I have Visual Studio 2012 Express for Desktop installed but nothing is showing up. I have tried uninstalling and re-installing but no luck.
推荐答案
一个简单的变通办法是简单地替换&LT;窗口&GT;
与 &LT; RibbonWindow&GT;
和&LT;丝带&GT;
作为第一个孩子。请记住,在<一个href="http://msdn.microsoft.com/en-us/library/system.windows.controls.ribbon.ribbon%28v=vs.110%29.aspx">Ribbon控制已经集成到.NET 4.5。
A simple work around would be to simply replace <Window>
with <RibbonWindow>
and <Ribbon>
as the first child. Keep in mind that the Ribbon control is already integrated into .NET 4.5.
首先修改 MainWindow.xaml
替换窗口
与 RibbonWindow
并添加&LT;丝带×:名称=丝带标题=丝带标题&GT;
First edit your MainWindow.xaml
by replacing Window
with RibbonWindow
and add <Ribbon x:Name="Ribbon" Title="Ribbon Title">
.
示例:
<RibbonWindow x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
x:Name="RibbonWindow"
Width="640" Height="480">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Ribbon x:Name="Ribbon" Title="Ribbon Title">
...........
</Ribbon>
</Grid>
</RibbonWindow>
您还需要编辑 MainWindow.xaml.cs
继承 RibbonWindow
类而不是窗口
。
You will also need to edit the MainWindow.xaml.cs
to inherit the RibbonWindow
class instead of Window
.
public partial class MainWindow : RibbonWindow
最后记得要导入从.NET Framework中的参考。
Last remember to import the reference from the .NET Framework.
System.Windows.Controls.Ribbon
编辑: 更新与解决方案 VB.Net
的
1)添加引用
- 右键点击您的项目,并选择
添加引用
。 - 找到
System.Windows.Controls.Ribbon
组件和框架下。 - 点击
确定
保存。
- Right click on your project and choose
Add Reference
. - Find
System.Windows.Controls.Ribbon
under Assemblies and Framework. - Click
OK
to save.
2)修改 MainWindow.xaml
- 备份任何现有的code。
- 替换为code。在我的例子中默认的模板。
- 在中添加新的内容
&LT;丝带&GT;&LT; /丝带&GT;
标记
- Back up any existing code.
- Replace the default template with the code in my Example.
- Add your new content within the
<Ribbon></Ribbon>
tag.
3)修改 Mainwindow.xaml.vb
- 右键点击
MainWindow.xaml
,点击查看code
。 - 修改
类窗口
到类RibbonWindow
。
- Right click on
MainWindow.xaml
and clickView Code
. - Change
Class Window
toClass RibbonWindow
.
4)运行程序!
这篇关于没有了“WPF丝带应用”项目模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!