问题描述
我有一个预览视图,一个新视图和一个旧视图。 我想要这样的东西:
I have a preview view, and a new view and an old view. I would like to have something like this:
<Type Name="TYPE">
<DisplayString ExcludeView="preview" IncludeView="old">{*this, view(preview old)}</DisplayString>
<DisplayString ExcludeView="preview">{*this, view(new)view(preview)}</DisplayString>
<Expand>
<!-- PREVIEW -->
<Item IncludeView="preview" Name='name'>name,s</Item>
<Item IncludeView="preview" ExcludeView="old" Name='[value]'>new_data</Item>
<Item IncludeView="preview" ExcludeView="new" Name='[value old]'>old_data</Item>
<Item IncludeView="preview" Name='stuff'>stuff</Item>
<!-- NON-PREVIEW -->
<Item ExcludeView="preview" Name="[name]">name</Item>
</Expand>
</Type>
请注意,我使用两种不同的DisplayStrings,有两种不同的方式尝试在两个视图中应用两个视图同一时间。
Note that I used two different DisplayStrings with two different ways to attempt to have two views applied at the same time.
我是否需要拆分这个以便我有一个preview_new和一个preivew_old视图? 那会很烦人,因为我的预览视图几乎是相同的,除此之外,常见项目可能会变大。 不仅如此,制作单独的视图
也不可能排除我的预览。 :(
Am I going to have to split this so that I have a preview_new and a preivew_old view? That would be annoying as my preview view is pretty much the same except for that, and the common items may get bigger. Not only that, making a separate view that excludes my preview will become impossible as well. :(
另外,如果没有匹配的DisplayString可用,我们可以指定显示多少项代替DisplayString吗?
Also, can we specify how many items will be shown in place of the DisplayString if no matching DisplayString is available?
谢谢,
A
我不介意有人将帖子标记为"建议作为答案",但不要将其标记为"已回答"。如果我是OP,我将决定帖子是否实际回答了我的帖子。谢谢。
I don't mind someone marking a post as "Proposed as answer", but DO NOT mark it as "Answered". If I am the OP, I will decide if a post actually answers my post or not. Thank you.
推荐答案
很高兴再次见到您: )
Glad to see you again:)
"我是否需要拆分这个以便我有一个preview_new和一个preivew_old视图? 那会很烦人,因为我的预览视图几乎是相同的,除此之外,常见项目可能会变大。 不仅如此,制作单独的
视图也不可能排除我的预览。 :("
是的,您必须将其拆分。不支持多个视图。解析器一次只支持一个。抱歉。
Yes, you will have to split it. Multiple views aren’t supported. The parser only supports one at a time. Sorry.
"另外,如果没有匹配的DisplayString可用,我们可以指定显示多少项来代替DisplayString吗?"
有无条件的DisplayString这样的东西。只需将它放在具有视图约束的那些之后:
There’s such a thing as unconditional DisplayString. Just put it after the ones with the view constraints:
< Type
Name = " Foo " >
< DisplayString
IncludeView = " 旧 " > Foo
旧 < / DisplayString >
<DisplayStringIncludeView="old">Foo Old</DisplayString>
< DisplayString
IncludeView = " new " > Foo
新 < / DisplayString >
<DisplayStringIncludeView="new">Foo New</DisplayString>
< DisplayString
IncludeView = " previewnew " > Foo
预览新 < / DisplayString >
<DisplayStringIncludeView="previewnew">Foo Preview New</DisplayString>
< DisplayString
IncludeView = " previewold " > Foo
预览旧 < / DisplayString >
<DisplayStringIncludeView="previewold">Foo Preview Old</DisplayString>
< DisplayString > Foo
后退{m_x} < / DisplayString >
< 展开 >
< 项目
IncludeView = " old; previewold "
名称 = " X " > m_x < / 项目 >
<ItemIncludeView="old;previewold"Name="X">m_x</Item>
< 项目
IncludeView = " new; previewnew "
名称 = " Y " > m_y < / 项目 >
<ItemIncludeView="new;previewnew"Name="Y">m_y</Item>
< 项目
IncludeView = " previewold "
名称 = " BR " > m_b < / 项目 >
<ItemIncludeView="previewold"Name="BR">m_b</Item>
< / 展开 >
< / 类型 >
注意:
查看名称不能包含"_",因为这不会解析。
谢谢,
杰克
这篇关于是否可以将两个视图应用于Item或其他natvis标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!