Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Create a property in your "PCM2PDMWidgetViewModel" say "RadioButtonName" and while creating "PCM2PDMWidgetViewModel" instance set the property to the name you want.. something like this</p> <pre><code>PCM2PDMWidgets.Add(new PCM2PDMWidgetViewModel { Description = "PCM2PDM 0", ID = 0, RadioButtonName = "Port B" }); PCM2PDMWidgets.Add(new PCM2PDMWidgetViewModel { Description = "PCM2PDM 1", ID = 1, RadioButtonName = "Port C" }); </code></pre> <p><strong>In PCM2PDMWidgetView XAML:</strong></p> <p>Change the radio button content to binding "Content="{Binding RadioButtonName}""</p> <pre><code>&lt;Grid Grid.Row="1"&gt; &lt;RadioButton Grid.Column="1" Content="{Binding RadioButtonName}" Command="{Binding PortCommand}" IsChecked="{Binding PortCheck}" Height="20" Width="60" HorizontalAlignment="Center" Margin="0,0,0,0" Name="PCM2PDMEnableRadioBtn" VerticalAlignment="Center" /&gt; &lt;/Grid&gt; </code></pre> <p>Instead of adding following elements in the constructor.. send them as a List as parameter to the constructor..</p> <p><strong>Your Code</strong></p> <p>_PortModeList.Add("Normal"); //Adding in Constructor _PortModeList.Add("Mode 1 - PCM + PDM"); _PortModeList.Add("Mode 2 - PDM only");</p> <p><strong>Solution for 2</strong></p> <p>public PCM2PDMWidgetViewModel(List comboBoxItems) { foreach(item in comboBoxItems) { _PortModeList.Add(item); } }</p> <p>While creating "PCM2PDMWidgetViewModel" instance send the List as constructor parameter (look at the following code)</p> <pre><code>PCM2PDMWidgets.Add(new PCM2PDMWidgetViewModel (new List&lt;string&gt;{"Normal","Mode 1 - PCM + PDM"}) { Description = "PCM2PDM 0", ID = 0, RadioButtonName = "Port B" }); PCM2PDMWidgets.Add(new PCM2PDMWidgetViewModel(new List&lt;string&gt;{"Normal","Mode 1 - PCM + PDM","Mode 2"}) { Description = "PCM2PDM 1", ID = 1, RadioButtonName = "Port C" }); </code></pre> <p><strong>For 4</strong></p> <p>you can fix this in the same way as radion button name.. </p> <p>set value for the "MemAddPoint" property in the same way you did for Description and ID. As this property is already binded to the textbox you don't need to change xaml bindings</p> <p><strong>For 3:</strong></p> <p>You have to create a new property in "PCM2PDMWidgetViewModel" of type "Visibility" and bind it to the togglebutton visibility property. set the property value while creating instance</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