Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6656275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:37:23+00:00 2026-05-26T01:37:23+00:00

In Silverlight 4 I have a DataGrid which is bound to a RIA DomainDataSource,

  • 0

In Silverlight 4 I have a DataGrid which is bound to a RIA DomainDataSource, all done in XAML. The AutoGenerateColumns property is set to false and each column is manually defined and bound. Basically this works fine.

Where I now run into problems is having an additional DataGridTextColumn which has no Binding. I want to manually populate the cells in this column in the code behind. When having this column without the Binding, at runtime the following exception pops up:

System.ArgumentNullException: Value cannot be null.
Parameter name: binding
   at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
   at System.Windows.Controls.DataGridTextColumn.GenerateElement(DataGridCell cell, Object dataItem)
   at System.Windows.Controls.DataGrid.PopulateCellContent(Boolean isCellEdited, DataGridColumn dataGridColumn, DataGridRow dataGridRow, DataGridCell dataGridCell)
   at System.Windows.Controls.DataGrid.AddNewCellPrivate(DataGridRow row, DataGridColumn column)
   at System.Windows.Controls.DataGrid.CompleteCellsCollection(DataGridRow dataGridRow)
   at System.Windows.Controls.DataGrid.GenerateRow(Int32 rowIndex, Int32 slot, Object dataContext)
   at System.Windows.Controls.DataGrid.AddSlots(Int32 totalSlots)
   at System.Windows.Controls.DataGrid.RefreshRows(Boolean recycleRows, Boolean clearRows)
   at System.Windows.Controls.DataGrid.RefreshRowsAndColumns(Boolean clearRows)
   at System.Windows.Controls.DataGrid.InitializeElements(Boolean recycleRows)
   at System.Windows.Controls.DataGridDataConnection.NotifyingDataSource_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.DomainDataSourceView.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.DomainDataSourceView.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.EntityCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.PagedEntityCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.PagedEntityCollectionView.RefreshView()
   at System.Windows.Controls.PagedEntityCollectionView.SourceCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.EntityCollectionView.HandleSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.PagedEntityCollection.RaiseCollectionChanged(NotifyCollectionChangedAction action, Entity entity, Int32 index)
   at System.Windows.Controls.PagedEntityCollection.CompleteLoad()
   at System.Windows.Controls.DomainDataSource.ProcessLoadedEntities(LoadContext loadContext, IEnumerable`1 entities)
   at System.Windows.Controls.DomainDataSource.DomainContext_Loaded(LoadedDataEventArgs e, LoadContext loadContext)

How can I avoid this exception and have my DataGrid with most columns bound and one column unbound?

Thanks in advance.

Edit:

My XAML looks as follows:

    <sdk:DataGrid AutoGenerateColumns="False"
        ItemsSource="{Binding Data, ElementName=MyDomainDataSource, Mode=OneWay}">
        <sdk:DataGrid.Columns>
            <sdk:DataGridTextColumn Binding="{Binding Name}" Header="Name" />
            <sdk:DataGridTextColumn Binding="{Binding CreationDate}" Header="Creation Date" />
            <sdk:DataGridTextColumn Header="Unbound Col" />
        </sdk:DataGrid.Columns>
    </sdk:DataGrid>

Edit #2:

One idea I found on the web was to bind the last column to some unique value (I have an ID in my data model) and use a custom IValueConverter which converts the ID to a dependent value. This would have been exactly what I wanted, but unfortunately I get the dependent value from a WCF service call, which is always asynchronous. As you cannot use async method calls in an IValueConverter this solution is not an option for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:37:23+00:00Added an answer on May 26, 2026 at 1:37 am

    Have you considered using a DataGridTemplateColumn instead? It does not matter if you set the binding or not for this type of column.

    For example, if you just want to set the unbound value once at the time of loading you could do something like this:

                        <sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBox x:Name="MyText" Loaded="MyText_Loaded"></TextBox>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
    

    …and then set the value in the code behind like this:

        private void MyText_Loaded(object sender, RoutedEventArgs e)
        {
            var textBox = sender as TextBox;
            if (textBox != null) textBox.Text = "My one off text"; 
        }
    

    I’m not sure what your exact requirements are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a silverlight datagrid which is bound to a PagedCollectionView displaying a collection
I have a Silverlight 4 DataGrid which has its ItemsSource bound to an ObservableCollection
I have 2 silverlight controls on a form; datagrid which is bound to list
I have a Silverlight DataGrid that contains a single template column which displays a
I have a simple Silverlight app which simply sets a DataGrid's ItemsSource to the
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
I have a Silverlight app with a DataGrid containing some custom columns and all
I have a DataGrid which is bound to a PagedCollectionView and the underlying collection
I have a specialprice lookup window in my silverlight project which is bound to
I have a Silverlight DataGrid and I have set the ItemsSource to an instance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.