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
195
Bind an observableCollection<string> to a cell in the Xamgrid
posted

Hi,

    I use a ViewModel as a source for my datagrid. One property is an observablecollection<string>. What happens is the observable column appears as a "+" sign to the left of every row and when i click on the "+" sign it shows me the columns whose types were observable. 

   Is it not possible to display them in a cell and not when the user clicks on the + sign? Also, when i select the column (observable) and when I try to get the currently selected record it throws a null but gets me the correct row when I click on the columns not of type observable. See code below.

   Please not that I have few observable columns which needs to be edited and few non editable.

 

void XamDgScheduledAudit_RecordActivated(object sender, Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs e)

        {

 

            var dr = e.Record.DataPresenter.ActiveRecord as DataRecord;            

 

            var recVal = dr.DataItem as ScheduleAuditInfoViewModel; 

        }

 

Thanks,
Ranjith 

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello Ranjith,

    You can make this ObservableCollection field to an unbound field and set its BindingPath property to the property of that type. You have to provide custom CellValuePresenter so that the cell will display data of type collection - make the control an items control.

    Hope this helps.

Children