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

  • SEARCH
  • Home
  • 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 1058239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:59:44+00:00 2026-05-16T17:59:44+00:00

I have created a datagrid with columns bound to an observable collection. All works

  • 0

I have created a datagrid with columns bound to an observable collection. All works well except for a column which is bound to a nullable decimal property from my business object.

If I use

<DataGridTextColumn Binding="{Binding Path=BaseUnitCostValue}" Header="Unit Cost Value" MinWidth="100" />

as my column definition all works well, however, as I will eventually want it to be a complex column I tried using a DatagridTemplateColumn such that

<DataGridTemplateColumn Header="Unit Cost Value" MinWidth="100">
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <TextBox Text="{Binding BaseUnitCostValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding BaseUnitCostValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Right"/>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

However, using this the column configuration, although I can enter a value as soon as I finish the edit to the cell, its value disappears.

I’ve also tried using converters to convert to a string and back again to a nullable decimal but with no luck.

I strongly suspect that this is something to with the fact that it’s bound to a nullable decimal. Is there something more I need to do to my cellTemplates so that the value binds correctly, in the same way is does when using a standard DataGridTextColumn?

Thanks

  • 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-16T17:59:45+00:00Added an answer on May 16, 2026 at 5:59 pm

    Maybe it’s because you try to make a two-way-binding for the TextBlock in the non-edit Template:

     <DataGridTemplateColumn.CellTemplate> 
            <DataTemplate> 
                <TextBlock Text="{Binding BaseUnitCostValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Right"/> 
            </DataTemplate> 
        </DataGridTemplateColumn.CellTemplate> 
    

    Try to change it to one-way, may it works then. Remove also the Trigger-statement.

    If it does not help, look in the output-window, if you see a related message.

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

Sidebar

Related Questions

I have found that datagrid columns can be dynamically created and bound in Silverlight.
I have created simple DataGrid with 4 columns, which go outside the bounds of
I have objects bound to a DataGrid. I have created a radio button column
Hi I have created a GWT datagrid, which has 10 columns. Of these 4
I have a dynamic DataGrid in which one of the columns is a CheckBox.
I am working in vs2010. I have created a DataGrid which is bounded to
I have a datagrid that's bound to an observablecollection object. The collection may be
I am creating window application basic. As i have created datagrid with 2 columns
I have a DataTable which is going to be bound to a DataGrid. I
I have a datagrid, which is bound to a RIA data object. this datagrid

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.