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 ObjectDataProviderhttp://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>
' ------------------------------------------' ViewModelOption Explicit OnOption Strict On
Imports System.Collections.ObjectModelImports 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 Class
Thanks.
Hello,
I have modified the sample I sent you before, so now it works as you want.
Hope this helps you.
Hello
No, I couldn't find a solution. Cannot be helped if there is no other way.
Hi!
Did someone find a solution? I am also interested in this topic.
Thanks
Thanks for your reply.
I downloaded and tried your project. I read and thought... Do I have to use ObjectDataProvider?
It is the following code which I desire. Is such coding difficult?
class ViewModel : INotifyPropertyChanged {
BindingList<Person> _Persons;
public BindingList<Person> Persons {
get { return _Persons; }
set {
_Persons = value;
this.OnPropertyChanged("Persons");
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(name));
<Grid.DataContext>
<local:ViewModel />
</Grid.DataContext>
<Grid.Resources>
<Style TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="ItemsSource" Value="{Binding Persons}" />
</Style>
</Grid.Resources>
my blog http://d.hatena.ne.jp/hilapon/
I have been looking into you requirement and I modified the sample I sent you before, so now it uses MVVM pattern.