“在Expression Blend中打开..." WPF项目缺少 [英] "Open in Expression Blend..." missing for WPF projects

查看:93
本文介绍了“在Expression Blend中打开..." WPF项目缺少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题.当我创建WPF项目并希望看到在以下位置打开"链接时 表达式混合"-它不像Silverlight项目那样存在.我可以使用打开方式"链接访问混合,然后打开混合并从那里开始工作.(即 解决).但是,从互联网搜索中,我发现必须在Visual Studio之前(而不是相反)安装Expression Blend,才能看到在表达式中打开 wpf专案」.这发生在Window 7 x64 OS和x32 ​​OS中.我也发现 使用"regedit"时,x64和x32的表达混合设置有所不同.

i'm having a problem. When i create a WPF project and want to see the link to "open in expression blend" - it is not there like a Silverlight project does. I can use the "open with" link to gain access to blend and then open blend and work from there. (That is the work around). However, from internet searching i found out that expression blend has to be installed before visual studio (not vice-a-versa) in order to see "open in expression blend" with a wpf project. This happens in Window 7 x64 OS and x32 OS. I also found when working with "regedit" that x64 and x32 are setup differently with respect to expression blend.

请有人帮助纠正此问题.

Somebody please help in correcting this problem.

推荐答案

似乎此功能根本不适用于WPF项目.当它起作用并且并不总是起作用时,它仅在Silverlight项目中起作用.但是,在Expression Blend中打开..."的功能并不是很复杂,因此这里是一个Visual Studio宏来代替它.

It seems that this feature simply isn't available for WPF projects. When it works, and it doesn't always work, it only works in Silverlight projects. However what "Open in Expression Blend..." does is not very complicated so here is a Visual Studio macro to take it's place.

Public Sub OpenInExpressionBlend()
    Dim blendPath As String = Nothing
    Dim key As String = "SOFTWARE\Microsoft\Expression\Blend\VS"
    Dim registryKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(key)
    If Not registryKey Is Nothing Then
        blendPath = registryKey.GetValue("BlendLaunchPath")
        registryKey.Close()
    End If
    If blendPath Is Nothing Then
        MsgBox("Cannot find Blend", MsgBoxStyle.Exclamation, "Open in Expression Blend")
        Return
    End If
    If DTE.SelectedItems.Count <> 1 Then
        MsgBox("Not just one item selected", MsgBoxStyle.Exclamation, "Open in Expression Blend")
        Return
    End If
    Dim item As SelectedItem = DTE.SelectedItems.Item(1)
    If Not TypeOf item.ProjectItem Is ProjectItem Then
        MsgBox("Not a project item", MsgBoxStyle.Exclamation, "Open in Expression Blend")
        Return
    End If
    Dim projectItem As ProjectItem = item.ProjectItem
    Dim project As Project = projectItem.ContainingProject
    Dim file As String = projectItem.Name
    If file.Substring(file.Length - 5) <> ".xaml" Then
        MsgBox("Not a xaml file", MsgBoxStyle.Exclamation, "Open in Expression Blend")
        Return
    End If
    While TypeOf projectItem.Collection.Parent Is ProjectItem
        projectItem = CType(projectItem.Collection.Parent, ProjectItem)
        file = projectItem.Name & "\" & file
    End While
    file = """" & file & """"
    Dim projectPath As String = """" & project.FullName & """"
    Dim blendArgs As String = projectPath & " /file:" & file
    Dim process As System.Diagnostics.Process = New System.Diagnostics.Process()

& blendArgs) process.Start(blendPath,blendArgs) 结束

& blendArgs) process.Start(blendPath, blendArgs) End Sub

更新:

要使用此功能,请使用Macro IDE添加宏,然后将其添加到项目项上下文菜单中,如下所示:

To use this, add the macro using the Macro IDE and then add it to the project item context menu like this:

工具->自定义->命令->上下文菜单:项目和解决方案上下文菜单|项目->添加命令...->类别:宏->命令:Macros.MyMacros.Personal.OpenInExpressionBlend->确定

Tools -> Customize -> Commands -> Context Menu: Project and Solution Context Menus | Item -> Add Command... -> Categories: Macro -> Commands: Macros.MyMacros.Personal.OpenInExpressionBlend -> OK

修改选择->名称:在Expression Blend中打开...

Modify Selection -> Name: Open in Expression Blend...

下移:(移至打开方式..."下方)

Move Down: (move below Open With...)

注意:该命令将取决于您将其添加到哪个模块.

Note: the command will depend on which Module you added it to.

这篇关于“在Expression Blend中打开..." WPF项目缺少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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