Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to know how to change the datagrid column value to change a textbox value outside my datagrid to change dynamically in sync with a specified datagrid column value.

What I have tried:

I have tried following solution without any results.
<DataGridTextColumn x:Name="dgRate" Header="RATE" Width="50" Binding="{Binding rate,ElementName=txtBox, Path=rate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat='C'}"/>
Posted
Updated 4-Apr-18 21:15pm

1 solution

The answer to this question depends on what you exactly mean by 'specified datagrid column value' and some small code samples could also be useful.

Most of the time, people want to see something about the selected row. The DataGrid DataGrid-Klasse (System.Windows.Controls)[^] has various properties:

- SelectedItem
- SelectedItems
- SelectedValue
- SelectionMode

which you could either:

1) bind to directly from your textbox or
2) you can bind the above properties to your viewmodel and then
have the textbox bind to a (pre-processed) property in your viewmodel.

The 2nd option is easier to debug and customize so you might want to look into that...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900