WPF How to handle property names with spaces?

Simple question since I had problems several times and I haven't found a solution until now. Surely these are peanuts for you.

I am trying to bind the Text property of a comboBox to a column in a dataTable. If the column name has no spaces, it works: For example:

Text="{Binding Path= MyColumn, ... }"

      

If the name has a space in between, it doesn't work: For example:

Text="{Binding Path= My Column, ... }"

      

There must be something to tell the compiler that the name consists of both words with a space ("My column"). But I haven't found it yet.

thank

+3


source to share


1 answer


The following delimiters didn't work: "" [] {}

What you need is single quotes ''



Text="{Binding Path= 'My Column', ... }"

      

+7


source







All Articles