【问题标题】:Silverlight combobox SelectedIndex not changing on bindingSilverlight 组合框 SelectedIndex 在绑定时未更改
【发布时间】:2012-01-04 13:09:53
【问题描述】:

在我的 Silverlight 3.0 应用程序中,我的数据网格中有一个组合框,它绑定到一个类。 当我更改组合框时,我可以获得类的索引,但是当我以编程方式更新类时组合框不会改变。

<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>

【问题讨论】:

  • 你的 cursunit 类看起来怎么样?

标签: xaml c#-4.0 silverlight-3.0


【解决方案1】:

您将所选索引绑定到的路径,它是否实现了 INotifyPropertyChanged 并更改了触发器属性?如果不是,那可能是问题所在。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 2011-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-27
    相关资源
    最近更新 更多