Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to bind WPF Combobox.SelectedValue to multiple ObjectDataProviders?
    text
    copied!<p>Trying to determine if it is possible to bind the SelectedValue of a ComboBox to the inputs of multiple ObjectDataProviders with XAMAL Bindings.</p> <p>I looked at MultiBinding but that appears to be grouping multiple controls together, not exactly what I'm looking to day.</p> <p>I'd like to be able to have the ComboBox (locations) change the TextBlock (deviance) which it does AND to call the ObjectDataProvider (CommentProvider) to update the TextBox (locationComments).</p> <p>This is fairly straightforward in a code-behind but would prefer to not go this route as a learning experience.</p> <p>XAMAL CODE</p> <pre><code>&lt;Window.Resources&gt; &lt;ObjectDataProvider x:Key="LocationProvider" ObjectType="{x:Type srv:ServiceClient}" IsAsynchronous="True"MethodName="GetAssignedLocations" /&gt; &lt;ObjectDataProvider x:Key="DevianceProvider" ObjectType="{x:Type srv:ServiceClient}" IsAsynchronous="True" MethodName="GetPercentChange"&gt; &lt;ObjectDataProvider.MethodParameters&gt; &lt;system:String&gt;Location1&lt;/system:String&gt; &lt;/ObjectDataProvider.MethodParameters&gt; &lt;/ObjectDataProvider&gt; &lt;ObjectDataProvider x:Key="CommentProvider" ObjectType="{x:Type srv:ServiceClient}" IsAsynchronous="True" MethodName="GetCommentByBusinessUnit"&gt; &lt;ObjectDataProvider.MethodParameters&gt; &lt;system:String&gt;Location1&lt;/system:String&gt; &lt;/ObjectDataProvider.MethodParameters&gt; &lt;/ObjectDataProvider&gt; &lt;/Window.Resources&gt; &lt;ComboBox Height="23" HorizontalAlignment="Left" Margin="12,12,0,0" Name="locations" VerticalAlignment="Top" ItemsSource="{Binding Source={StaticResource LocationProvider}}" DisplayMemberPath="BuName" SelectedValuePath="BuKey" SelectionChanged="locations_SelectionChanged"&gt; &lt;ComboBox.SelectedValue&gt; &lt;Binding Source="{StaticResource DevianceProvider}" Path="MethodParameters[0]" BindsDirectlyToSource="True" Mode="OneWayToSource" /&gt; &lt;/ComboBox.SelectedValue&gt; &lt;TextBlock Name="deviance" Height="23" Margin="0,0,645,17" Width="40" Text="{Binding Source={StaticResource DevianceProvider}}" IsEnabled="False" /&gt; &lt;TextBox Height="23" Margin="0,0,181,17" Name="locationComments" Width="350" /&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