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
285
XAMDataGrid not rebinding
posted

I  have bound a property defined as an IBindingList to an XAMDataGrid.  The property is in the ViewModel assigned to that view.  When the WPF form loads, it shows the correct data.  If I click a button to load a different set of data, the correct method in the ViewModel is called and the IBindingList property is updated with the new records.  But the XAMDataGrid never changes it's records.  It still shows the first set of records.

Here's the bound property:

 

 

 

 

 

public

 

 

IBindingList

objLookupDataList

{

 

 

get

{

 

 

return

m_objLookupDataList;

}

 

 

set

{

m_objLookupDataList =

 

value;

 

 

base.RaisePropertyChangedEvent("objLookupDataList"

);

 

OnRaisePropertyChanged is in the base class; it owrks as proved by textboxes bound to properties on the same ViewModel calling base.RasePropertyChangedEvent

Here's the XAML  XAMDataGrid:

 

 

 

 

<

 

 

igDP:XamDataGrid Margin="16,51,13,12" Name="dgLookupTable" TabIndex="2" FieldLayoutInitialized="dgLookupTable_FieldLayoutInitialized" DataSource="{Binding Path=objLookupDataList,ValidatesOnExceptions=True,UpdateSourceTrigger=PropertyChanged,NotifyOnValidationError=True,ValidatesOnDataErrors=True}" AutoFit="True" RecordUpdating="dgLookupTable_RecordUpdating" Grid.Row="1"></igDP:XamDataGrid>

Finally, here is the xaml code behind regardind the XAMDataGrid:

///

 

<summary>

 

/// Defines properites for the dgLookupTable grid.

 

/// </summary>

 

private void SetdgLookupTableDataGrid()

{

dgLookupTable.FieldLayoutSettings.AutoGenerateFields =

false;

dgLookupTable.FieldLayoutSettings.AllowAddNew =

true;

dgLookupTable.FieldLayoutSettings.AddNewRecordLocation =

AddNewRecordLocation.OnTopFixed;

dgLookupTable.FieldSettings.AllowEdit =

true;

dgLookupTable.FieldLayoutSettings.AllowDelete =

true;

dgLookupTable.UpdateMode =

UpdateMode.OnRecordChangeOrLostFocus;

dgLookupTable.FieldLayoutSettings.HighlightAlternateRecords =

true;

dgLookupTable.FieldLayoutSettings.SelectionTypeCell =

SelectionType.Single;

dgLookupTable.FieldLayoutSettings.SelectionTypeRecord =

SelectionType.Single;

dgLookupTable.FieldSettings.CellClickAction =

CellClickAction.Default; ;

dgLookupTable.FieldSettings.CellContentAlignment =

CellContentAlignment.LabelAboveValueAlignCenter;

dgLookupTable.FieldSettings.LabelTextAlignment = System.Windows.

TextAlignment.Center;

dgLookupTable.FieldSettings.AllowRecordFiltering =

false;

dgLookupTable.IsNestedDataDisplayEnabled =

false;

dgLookupTable.FieldLayoutSettings.SupportDataErrorInfo =

SupportDataErrorInfo.RecordsAndCells;

dgLookupTable.FieldLayoutSettings.DataErrorDisplayMode =

DataErrorDisplayMode.ErrorIconAndHighlight;

 

// bind a property to the Visibility property

 

//System.Windows.Visibility SFWHoldingFacilitiesGridVisibility = Model.dgLookupGridVisibility;

 

//Binding dgLookupGridVisibilityBinding = new Binding("dgLookupGridVisibility");

 

//SFWHoldingFacilitiesGridVisibilityBinding.Source = Model;

 

//SFWHoldingFacilitiesGridVisibilityBinding.Mode = BindingMode.Default;

 

//dgLookupTable.SetBinding(XamDataGrid.VisibilityProperty, dgLookupGridVisibilityBinding);

 

//this.dgLookupTable.Visibility = System.Windows.Visibility.Visible;

}

 

/// <summary>

 

/// Defines the fields layout for the dgLookupTable grid.

 

/// </summary>

 

/// <param name="sender"></param>

 

/// <param name="e"></param>

 

private void dgLookupTable_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e)

{

 

FieldSettings fs = null;

 

Field CodeField = new Field();

CodeField.Visibility =

Visibility.Visible;

fs =

new FieldSettings();

fs.AllowHiding =

AllowFieldHiding.Never;

fs.AllowRecordFiltering =

false;

fs.AllowResize =

true;

fs.CellMinHeight = 23;

fs.CellMinWidth = 250;

CodeField.Settings = fs;

CodeField.Name =

"Code";

CodeField.Label =

LookupsResources.ResourceManager.GetString("Code", CultureInfo.CurrentUICulture);

CodeField.Width =

new FieldLength(100);

CodeField.IsScrollTipField =

true;

 

 

Field DescriptionField = new Field();

DescriptionField.Visibility =

Visibility.Visible;

fs =

new FieldSettings();

fs.AllowHiding =

AllowFieldHiding.Never;

fs.AllowRecordFiltering =

false;

fs.AllowResize =

true;

fs.CellMinHeight = 23;

fs.CellMinWidth = 250;

DescriptionField.Settings = fs;

DescriptionField.Name =

"Description";

DescriptionField.Label =

LookupsResources.ResourceManager.GetString("Description", CultureInfo.CurrentUICulture);

DescriptionField.Width =

new FieldLength(100);

DescriptionField.IsScrollTipField =

true;

e.FieldLayout.Fields.Add(CodeField);

e.FieldLayout.Fields.Add(DescriptionField);

}