Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting WPf Datagrid Combobox value to its respective textbox
    text
    copied!<p>I am having a textbox and a combobox as a template column. Below is XAML</p> <pre><code>&lt;wpfkit:DataGrid Margin="3" Style="{DynamicResource SimpleDataGrid}" FontWeight="Normal" MaxHeight="100" CanUserAddRows="True" ItemsSource="{Binding Source={StaticResource odpExistingGHSCodesColl}}" AutoGenerateColumns="False" Name="dgGHS" VerticalScrollBarVisibility="Visible" &lt;wpfkit:DataGrid.Columns&gt; &lt;wpfkit:DataGridTemplateColumn IsReadOnly="True"&gt; &lt;wpfkit:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;Image Style="{DynamicResource SimpleImageDelete}"/&gt; &lt;/DataTemplate&gt; &lt;/wpfkit:DataGridTemplateColumn.CellTemplate&gt; &lt;/wpfkit:DataGridTemplateColumn&gt; &lt;wpfkit:DataGridTemplateColumn IsReadOnly="True"&gt; &lt;wpfkit:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ComboBox x:Name="cbTGHSCodes" ItemsSource="{Binding Source={StaticResource odpGHSCodesColl}}" DisplayMemberPath="fldCode" SelectedItem="{Binding Path=fldGHSCodeList}" SelectedValue="fldCode" SelectedValuePath="fldDescription"&gt; &lt;/ComboBox&gt; &lt;/DataTemplate&gt; &lt;/wpfkit:DataGridTemplateColumn.CellTemplate&gt; &lt;/wpfkit:DataGridTemplateColumn&gt; &lt;wpfkit:DataGridTemplateColumn IsReadOnly="True"&gt; &lt;wpfkit:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBox x:Name="tbTGHSCodeDescription" Text="{Binding Path=fldDescription, ElementName=cbTGHSCodes}"&gt; &lt;/TextBox&gt;&lt;/DataTemplate&gt; &lt;/wpfkit:DataGridTemplateColumn.CellTemplate&gt; &lt;/wpfkit:DataGridTemplateColumn&gt; &lt;/wpfkit:DataGrid.Columns&gt; &lt;/wpfkit:DataGrid&gt; </code></pre> <p>I am having a observable collection (odpGHSCodesColl) in which i am inserting Codes and its Respective description. code is stored is fldCodes property while fldDescription has description. So what i want to achieve is that say if Code P1 has Desc ABC , P2 has DFG, P4 has UHY , then if select P1 from combobox then the corresponding textbox in next column will get filled with ABC , if P2 then DFG and so on. I hope you can understand. I am unable to find any events attached. If possible give me some example in XAML itself so that i need to write lesser code.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload