Blend 4 使用 ItemTemplate 中的 GoToStateAction 行为更改窗口状态
我已经尝试让它工作几个小时了。
我有一个列表框控件,其中包含数据库中的项目。我有 2 个窗口状态,“默认”和“详细信息”。我想在 ItemTemplate 中使用 GoToStateAction 行为,以便当单击列表框中的任何项目时,它会将窗口状态更改为“详细信息”。
我一直试图将行为的 TargetObject 属性设置为窗口,但我不能。
我错过了什么,或者做错了什么吗?任何帮助将不胜感激。
I've been trying to get this working for a few hours now.
I have a Listbox control with items from a database in it. I have 2 window states, "default", and "details". I'd like to use the GoToStateAction behavior in the ItemTemplate so that when any item in the listbox is clicked it'll change the window state to "details".
I have been trying to set the TargetObject property of the behavior to the window, but I can't.
Am I missing something, or doing something wrong? Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过
TargetObject="{BindingrelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
?您可能希望将类型更改为
{x:Type local:MyWindowType}
之类的类型。Have you tried
TargetObject="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
?You might want to change the type to something like
{x:Type local:MyWindowType}
.