Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

I need a TextBox that binds to the value of a specific column(MRN) in the currently selected row of a DataTable in XAML

$
0
0

I have a WPF window. Its DataContext is set to a ViewModel that contains a DataTable exposed as a property named dtPatientData. I have a datagrid (ComponentOne) that has its ItemsSource set to this property. The datagrid correctly binds the table and displays it. I want to also have a TextBox that binds to the value of a specific column(MRN) in the currently selected row. I'm failing. Here's my XAML:

<C1DataGrid:C1DataGridHorizontalAlignment="Left"Margin="10,0,0,10"VerticalAlignment="Bottom"Width="504"Height="143"ItemsSource="{Binding dtPatientData}"/><TextBoxText="{Binding Source=dtPatientData, Path=MRN}"/>

I get the following:System.Windows.Data Error: 40 : BindingExpression path error: 'MRN' property not found on 'object' ''String' (HashCode=1384163063)'. BindingExpression:Path=MRN; DataItem='String' (HashCode=1384163063); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')

I've tried all kinds of things. How can I do this in XAML?


Michael


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>