Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Combobox based databinding Textbox
    text
    copied!<p>I have been trying to find a solution to this one but could not find a relevant answer online.</p> <p>I have a bunch of text boxes that I need to populate with data, for example in my case address. I have a combo box that is bound to an enum and has a list of values to select from </p> <p>Home, Office, MainOffice, Laboratory. etc. When I make a selection on combobox, I need to populate its address in the text boxes below. I can get Home address from object X, Office Address from Object Y, MainOffice from Z. How do I do this conditional databinding using combobox selection. Please advise. </p> <p>These are the options that I could select</p> <pre><code>public enum MailToOptions { Home, Office, CorporateOffice, Laboratory, } &lt;!-- Row 1 --&gt; &lt;Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Content="Mail To:" /&gt; &lt;ComboBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="5" Name="MailToComboBox" ItemsSource="{Binding Source={StaticResource odp}}" SelectionChanged="HandleMailToSelectionChangedEvent" &gt; &lt;/ComboBox&gt; &lt;!-- Agency ID --&gt; &lt;!-- Name --&gt; &lt;Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" Content="Name" /&gt; &lt;TextBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5"&gt; &lt;TextBox.Text&gt; &lt;Binding Path="Order.Agency.PartyFullName" Mode="TwoWay" /&gt; &lt;/TextBox.Text&gt; &lt;/TextBox&gt; &lt;!-- Row 2 --&gt; &lt;!-- Address Line 1 --&gt; &lt;Label Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5" Content="Address 1" /&gt; &lt;TextBox Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="5"&gt; &lt;TextBox.Text&gt; &lt;Binding Path="Order.Agency.AddressLine1" Mode="TwoWay" /&gt; &lt;/TextBox.Text&gt; &lt;/TextBox&gt; </code></pre>
 

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