Silverlight Datagrid SelectedIndex不变 [英] Silverlight Datagrid SelectedIndex not changing

查看:81
本文介绍了Silverlight Datagrid SelectedIndex不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的Silverlight应用程序中,我的数据网格中有一个组合框绑定到一个类.
当我更改组合框时,可以获取该类的索引,但是当我以编程方式更新该类时,组合框并没有改变
请帮我解决这个问题. 紧急.

Hi,
In my silverlight application, I have a combobox in my datagrid that binds to a class.
When I change the combobox, I can get the Index to the class, But the combobox doesn''t change when I update the class programmatically
Please Help me to sort this out. urgent.

<data:datagridtemplatecolumn header="Sale Unit" width="80" xmlns:data="#unknown">
    <data:datagridtemplatecolumn.celleditingtemplate>
        <datatemplate>
            <combobox itemspanel="{Binding RelativeSource={RelativeSource Self}}" datacontext="{Binding}" selectedindex="{Binding Path=cursunit,Mode=TwoWay}" keydown="ComboBox_KeyDown" loaded="ComboBox_Loaded" selectionchanged="ComboBox_SelectionChanged">
            <comboboxitem content="BOX" />
            <comboboxitem content="STRIP" />
            <comboboxitem content="PEICE" />
            </combobox>
        </datatemplate>
    </data:datagridtemplatecolumn.celleditingtemplate>
</data:datagridtemplatecolumn>

推荐答案

由于您未提供任何代码,因此只是猜测.但是,如果您的代码已经为组合框设置了SelectedItem,则对象实例可能与组合中加载的对象实例不同.要测试此效果,请尝试设置SelectedIndex并查看是否可行.
Since you didn''t provide any code, it''s just guessing. But if you''re code already sets the SelectedItem for the combobox, probably the object instance is different that''s loaded in your combo. To test this try setting SelectedIndex and see if that works.


这篇关于Silverlight Datagrid SelectedIndex不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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