设置自动生成的listboxitem的属性 [英] Setting properties of auto-generated listboxitem

查看:86
本文介绍了设置自动生成的listboxitem的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置数据绑定ListBox的自动生成的ListBoxItems的inputbindings. 下面的代码不起作用.编译器抱怨无法设置属性设置器'InputBindings',因为它没有可访问的集合访问器." 设置InputBindings的正确语法是什么?

I am trying to set the inputbindings of the auto-generated ListBoxItems of a databound ListBox. The code below does not work. The compiler complains that "The Property Setter 'InputBindings' cannot be set because it does not have an accessible set accessor." What is the correct syntax to set the InputBindings?

    <ListBox.ItemContainerStyle>
        <Style TargetType="{x:Type ListBoxItem}">
            <Setter Property="ListBoxItem.InputBindings">
                <Setter.Value>
                    <MouseBinding Command="{Binding OpenCommand}" Gesture="LeftDoubleClick"/>
                </Setter.Value>
            </Setter>
        </Style>
    </ListBox.ItemContainerStyle>

PS:在Opera 10.51中发布不起作用

PS: Posting does not work with Opera 10.51

推荐答案

这确实很棘手.

我为您找到了两个建议的解决方案,恐怕都不是很容易实现的解决方案.希望它对您有用!

This one is indeed tricky.

I found two proposed solutions for you, neither are very easy to implement I am afraid. I hope it works for you!

  • link one
  • Link two

这篇关于设置自动生成的listboxitem的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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