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 3455708
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:38:50+00:00 2026-05-18T09:38:50+00:00

Hi I am binding a WPF textbox to an Entity Framework property as follows:

  • 0

Hi I am binding a WPF textbox to an Entity Framework property as follows:

<TextBox Grid.Column="1" Grid.Row="0" Margin="5,2" 
         Text="{Binding Path=MyEntityObject.SizeLower, Mode=TwoWay}" />

It binds fine to the property and when I change it, it saves to the DB as expected. But if I delete the content of the Textbox I get the red error border around it. I dont have any validator in place so I am guessing the texbox is complaining about the value not being nullable. But in fact this property in the DB is nullable, so I cannot understand why it would error.

The system generated EF property definition is as follows:

<EdmScalarPropertyAttribute(EntityKeyProperty:=false, IsNullable:=true)>
<DataMemberAttribute()>
Public Property SizeLower() As Nullable(Of Global.System.Int64)
    Get
        Return _SizeLower
    End Get
    Set
        OnSizeLowerChanging(value)
        ReportPropertyChanging("SizeLower")
        _SizeLower = StructuralObject.SetValidValue(value)
        ReportPropertyChanged("SizeLower")
        OnSizeLowerChanged()
    End Set
End Property

Private _SizeLower As Nullable(Of Global.System.Int64)

Is there something I am missing? I thought the binding system was able to determine if a property was nullable and allow nulls if so?

How can I see what the error is? Hovering doesnt seem to do the trick.

Thanks for any advice.

===================================
ADDITIONAL INFO

If I select all and delete, then change focus, the validation box appears. Here’s a screencapture before and after. Also I have confirmed that I can manually put NULLs in the database for the bound properties so thats not the problem.

DENIED. Tried to put picture here but I dont have 10 points…!
Here is an offsite link instead: CLICK HERE

  • 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-18T09:38:51+00:00Added an answer on May 18, 2026 at 9:38 am

    You should add the TargetNullValue property to your binding:

    <TextBox Grid.Column="1" Grid.Row="0" Margin="5,2" 
             Text="{Binding Path=MyEntityObject.SizeLower, 
             Mode=TwoWay, 
             TargetNullValue=''}" />
    

    This tells the binding to treat null values in MyEntityObject.SizeLower as string.empty for display, and string.empty as null when setting.

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

Sidebar

Related Questions

I have a WPF TextBox, defined like this: <TextBox Text={Binding Path=/Comments} Margin=351,193.91,10,36 x:Name=txtComments IsReadOnly=True
So it's like this, I have a wpf binding <TextBox Name=txtRackNo Grid.Column=5 Grid.ColumnSpan=7 Grid.Row=4
I have a WPF textbox with a binding to the datacontext. <TextBox Grid.Column=1 Grid.Row=4
Example: <UserControl x:Name=userControl <StackPanel x:Name=container Margin=0> <TextBox Text={Binding Path=SettingValue, RelativeSource={RelativeSource Mode=Self}}/> </StackPanel> </UserControl> UserControl
I've got a simple WPF dialog with these two controls: <TextBox Text={Binding MyText}/> <Button
I have the following binding in my wpf application xaml: <TextBox Text={Binding Amount, StringFormat=c}
I have a form in WPF with 2 textbox : <TextBox Name=txtName Text={Binding Contact.Name}/>
I have a WPF view with a TextBox, binding the Text field to a
What does {Binding Path=.} mean in a WPF binding? I see some people use
I have a WPF app that uses an Entity Framework Model. One of the

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.