Silverlight Datagrid组合框SelectedIndex绑定 [英] Silverlight Datagrid Combobox SelectedIndex Binding

查看:79
本文介绍了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>

推荐答案

检查这些博客
http://blog.digitaltools.com/post/2011/05/06/Binding-a-Datagride28099s-ComboBox.aspx [ ^ ]
http://www.dotnetfunda. com/forums/thread1506-how-to-bind-data-to-combobox-inside-datagrid-using-sliverlight.aspx [
check these blogs
http://blog.digitaltools.com/post/2011/05/06/Binding-a-Datagride28099s-ComboBox.aspx[^]
http://www.dotnetfunda.com/forums/thread1506-how-to-bind-data-to-combobox-inside-datagrid-using-sliverlight.aspx[^]
--NDK



根据您的代码,我认为您应该只在DataGrid编辑模式下看到组合框
因此,请在更改绑定对象的值时检查,确保datagrid处于编辑"模式,然后它才可以工作.按代码执行就可以了.


问候
西拉子(Siraz)
hi
As per your code i think you should see the combobox in DataGrid Edit mode only
so check while changing the value of binding object, that datagrid is in Edit mode ,then only it will work.codewise it is ok.


Regards
Siraz


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

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