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
175
Trouble binding a nested observable collection to unboundfield containing xamcomboeditor
posted

I have a question regarding XamDataGrid, and a XamComboEditor in an unboundfield.  The XamDataGrid is acting as a type of shopping cart.  It is bound to an ObservableCollection of LineItemViewModels (Property is VmCatLineItems).  One of the properties of a line item is that it contains an ObservableCollection of AllowableShipMethods (different line items may have different ship methods).  I am trying to get that collection of ship methods to bind to the XamComboEditor in the unboundfield, but have been unsuccessful.  I would appreciate any suggestions.

 

XamDataGrid Info:

<igWpf:XamDataGrid x:Name="DgCart2" KeyUp="DgCart2_OnKeyUpDeleteItem" TabIndex="3" ActiveDataItem="{Binding VmCartLineItems}" DataSource="{Binding VmCartLineItems, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" RecordsDeleted="DgCart2_OnRecordsDeleted" CellUpdated="UpdateTotal" IsSynchronizedWithCurrentItem="True" Theme="Aero" Width="932" Canvas.Top="50" Margin="0,15,0,0" Height="390" >

 

UnboundField Info:

<!--Ship Method Field-->

<igWpf:UnboundField Height="30" Width="86" x:Name="ShipMethod" Label="Ship Method">

       <igWpf:UnboundField.Settings>

       <igWpf:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}">

       <igWpf:FieldSettings.EditorStyle>

       <Style TargetType="{x:Type igEditors:XamComboEditor}">

        <Setter Property="ItemsSource" Value="{Binding VmCartLineItems.Items[0].AllowableShipMethods}"/>

        <Setter Property="DisplayMemberPath" Value="ShippingName" />

        <Setter Property="ValuePath" Value="ShippingCode" />

<Setter Property="SelectedIndex" Value="0"/>

       <Setter Property="VerticalContentAlignment" Value="Stretch"/>

       <EventSetter Event="SelectedItemChanged" Handler="OnShipMethodChanged"></EventSetter>

</Style>

       </igWpf:FieldSettings.EditorStyle>

       </igWpf:FieldSettings>

       </igWpf:UnboundField.Settings>

       </igWpf:UnboundField>

 

Property Contained in OrderEntryViewlModel the XamDataGrid is bound to:

        public ObservableCollection<LineItemsViewModel> VmCartLineItems

        {

            get { return _vmItems; }

            set

            {

                _vmItems = value;

                RaisePropertyChanged("VmCartLineItems");

            }

        }

 

That property contains within it the following, which is what I am trying to bind in the ship method field:

  public ObservableCollection<ShippingMethods> AllowableShipMethods

        {

            get

            {

                return this.allowableShipMethods;

            }

            set

            {

                if (this.allowableShipMethods != value)

                {

                    this.allowableShipMethods = value;

                    this.RaisePropertyChanged("AllowableShipMethods");

                }

            }

        }

 

 

Parents
  • 17475
    Offline posted

    Hello Lloyd, 

    I have been looking through your post and created a sample project based on the provided code snippet. I have bound the ItemsSource property of the XamComboEditor to the DataItem.AllowableShipMethods collection. Then the user can choose between the items of this collection using the ComboEditor.  

    Please have a look at the attached project and let me know if it helps you in resolving your issue.

    XamDataGridUnboundCombo.zip
Reply Children