Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF datagrid - Update property after combo item selected
    primarykey
    data
    text
    <p>I'm new to WPF and have a question about an issue I'm having with a combobox on a datagrid. When an item is selected from the combo, the bound property does not update like I expect.</p> <p>Since I can't post images (this is the first time I've posted to SO), I'll attempt to explain. If I select "D00120" from the combo list, the combo will reflect the change but the grid property does not get changed.</p> <p>Xaml:</p> <pre><code>&lt;DataGridTemplateColumn Header="CPT Code" Width="75"&gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ComboBox ItemsSource="{Binding PartBCombo, RelativeSource={RelativeSource AncestorType=Window}}" DisplayMemberPath="PartBLookup_CPTCode" SelectedValuePath="PartBLookup_ProcedureDescription" SelectedValue="{Binding PartBBilling_ProcedureName, UpdateSourceTrigger=PropertyChanged}" /&gt; &lt;/DataTemplate&gt; &lt;/DataGridTemplateColumn.CellTemplate&gt; &lt;/DataGridTemplateColumn&gt; </code></pre> <p>Property for combo items:</p> <pre><code> Partial Public Class PartBBilling_Combobox Private _PartBLookup_CPTCode As String Public Property PartBLookup_CPTCode As String Get Return _PartBLookup_CPTCode End Get Set(value As String) _PartBLookup_CPTCode = value End Set End Property Private _PartBLookup_ProcedureDescription As String Public Property PartBLookup_ProcedureDescription As String Get Return _PartBLookup_ProcedureDescription End Get Set(value As String) _PartBLookup_ProcedureDescription = value End Set End Property End Class </code></pre> <p>Property for datagrid:</p> <pre><code> Private _PartBBilling_CPT As String Public Property PartBBilling_CPT As String Get Return _PartBBilling_CPT End Get Set(value As String) _PartBBilling_CPT = value RaisePropertyChanged("PartBBilling_CPT") End Set End Property Private _PartBBilling_ProcedureName As String Public Property PartBBilling_ProcedureName As String Get Return _PartBBilling_ProcedureName End Get Set(value As String) If _PartBBilling_ProcedureName &lt;&gt; value Then _PartBBilling_ProcedureName = value RaisePropertyChanged("PartBBilling_ProcedureName") End If End Set End Property </code></pre> <p>When an item is selected, the UI displays correctly but the grid property does not get updated. Other than that, the combobox functions just fine.</p> <p>Thanks for any help or advice.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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