Nabeel Khan Nabeel Khan - 1 year ago 218
SQL Question

Ampersand (&) in WPF c# datagrid bind with database table

i cannot bind the table name in datagrid.
its not accepting the ampersand (&) table name in xaml.

here is the code.

<DataGrid x:Name="TOTAL_DATAGRID" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ColumnWidth="80" Margin="54,113,62,114"> <DataGrid.Columns> <DataGridTextColumn Header="Kiln_TotalKWh" Binding="{Binding Energy_KILN_HOUR_Total_kiln&cooler_KWH_Value}" Width="80" /> < /DataGrid.Columns> </DataGrid>

Answer Source

You can replace ampersand with &amp; in XAML

update from comments

Binding Path is to link XAML with the corresponding ViewModel Property. You can't need an ampersand there.

If what you are doing is like databinding using database then you can rename the column name in the select with the AS keyword

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download