Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
How to bind to ComboBoxItemsProvider from ViewModel's collection ?
posted

Hello, I'm a Japanese. Sorry, I can speak English a little.

How to set combobox to cell of XamDataGrid. I saw exsample and news, Used XML resources. but i didn't find how to bind XamComboEditor from ViewModel's collection.

Now, I'm using ObjectDataProviderto to refer to article, but Iwant to use ViewModel collection. how to use it?

ComboBoxItemsProvider and ObjectDataProvider
http://forums.infragistics.com/forums/p/9408/36631.aspx

<Window.Resources>
    <!--XamComboEditor Style-->
    <ObjectDataProvider x:Key="dataProvider" ObjectType="{x:Type local:VehicleTypes}" MethodName="Create" />
    <Style x:Key="XamComboEditorStyle1" TargetType="{x:Type igEditors:XamComboEditor}">
        <Setter Property="ItemsProvider">
            <Setter.Value>
                <igEditors:ComboBoxItemsProvider
                    ItemsSource="{Binding Source={StaticResource dataProvider}}"
                    DisplayMemberPath="Summary"
                    ValuePath="TypeId" />
            </Setter.Value>
        </Setter>
    </Style>
</Window.Resources>


' ------------------------------------------
' ViewModel
Option Explicit On
Option Strict On

Imports System.Collections.ObjectModel
Imports Livet


Public Class VehicleSearchViewModel
    Inherits ViewModel

#Region "コンストラクタ"

    Public Sub New()
        Me.Options = VehicleOptions.Create()
        Me.Types = VehicleTypes.Create()
    End Sub

#End Region

#Region "プロパティ"

#Region "Options変更通知プロパティ"
    Private _Options As IEnumerable(Of Object)

    Public Property Options() As IEnumerable(Of Object)
        Get
            Return _Options
        End Get
        Set(ByVal value As IEnumerable(Of Object))
            _Options = value
            RaisePropertyChanged("Options")
        End Set
    End Property
#End Region

#Region "Types変更通知プロパティ"
    Private _Types As IEnumerable(Of Object)

    Public Property Types() As IEnumerable(Of Object)
        <DebuggerStepThrough()>
        Get
            Return _Types
        End Get
        Set(ByVal value As IEnumerable(Of Object))
            _Types = value
            RaisePropertyChanged("Types")
        End Set
    End Property
#End Region

#Region "Vehicles変更通知プロパティ"
    Private _Vehicles As ObservableCollection(Of Vehicle)

    Public Property Vehicles() As ObservableCollection(Of Vehicle)
        Get
            Return _Vehicles
        End Get
        Set(ByVal value As ObservableCollection(Of Vehicle))
            _Vehicles = value
            RaisePropertyChanged("Vehicles")

            Me.ClearCommand.RaiseCanExecuteChanged()
            Me.DetailCommand.RaiseCanExecuteChanged()
        End Set
    End Property
#End Region

#End Region

End Class

Thanks.

Parents Reply Children
No Data