【问题标题】:Devexpress ComboBoxEditSettings not binding to ViewModel in WPFDevexpress ComboBoxEditSettings 未绑定到 WPF 中的 ViewModel
【发布时间】:2012-07-19 21:15:01
【问题描述】:

我在使用 ComboBoxEditSettings 时遇到了 DevExpress wpf 网格绑定问题。下面是网格。我将“关联井类型”列绑定到我的 ViewModel 上的一个属性。但是,当我从组合框中选择一些项目然后单击“确定”时,我会在单元格中看到所选项目,但它们不会绑定回我的 ViewModel。那么,我需要对“确定”按钮的点击事件做些什么吗?有没有 绑定中的某些内容我没有正确设置?上述所有的? 提前感谢您的帮助。

<ctrls:GridControl Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Margin="5" 
                               dx:ThemeManager.ThemeName="Office2007Blue"
                               x:Name="gridControlForms" VerticalAlignment="Stretch"
                               ShowLoadingPanel="{Binding TaxFormsIsBusy}"
                               ItemsSource="{Binding TaxFormList}" >
<ctrls:GridControl.Columns>
            <dxg:GridColumn FieldName="DisplayName" Header="Form Name" VisibleIndex="1" AllowMoving="False" />
            <dxg:GridColumn ReadOnly="True" FieldName="PrintSequence" Header="Print Sequence" VisibleIndex="2" AllowMoving="False" />
            <dxg:GridColumn Header="Associated Well Types" FieldName="SelectedWellTypes" VisibleIndex="3" AllowMoving="False" AllowBestFit="True" Width="300" >
                <dxg:GridColumn.EditSettings>
                            <dxe:ComboBoxEditSettings ItemsSource="{Binding WellTypes}" DisplayMember="WellType" ValueMember="RenditionStateFormWellTypeId" IsTextEditable="False" >
                                <dxe:ComboBoxEditSettings.StyleSettings>
                                            <dxe:CheckedComboBoxStyleSettings />
                                </dxe:ComboBoxEditSettings.StyleSettings>
                            </dxe:ComboBoxEditSettings>
                </dxg:GridColumn.EditSettings>
            </dxg:GridColumn>
</ctrls:GridControl.Columns>           
<ctrls:GridControl.View>
            <dxg:TableView ShowGroupPanel="False"  BestFitArea="All" AllowSorting="False" 
                                   FocusedRow="{Binding SelectedTaxForm, Mode=TwoWay}" AllowColumnFiltering="False" />
</ctrls:GridControl.View>

【问题讨论】:

    标签: wpf xaml grid devexpress


    【解决方案1】:

    我发现了问题:网格抛出“对象必须实现 IConvertible”错误。一旦发现这一点,我将 SelectedWellTypes 从 int 更改为 IEnumberable 类型的对象,并在视图模型中进行了适当的转换。这允许发生绑定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-01
      • 2010-12-05
      • 1970-01-01
      • 2020-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      相关资源
      最近更新 更多