forum

Home / DeveloperSection / Forums / Resetting binding's source in wpf

Resetting binding's source in wpf

Anonymous User 3083 19-Aug-2014

I have this list box:

<ListBox DockPanel.Dock="Left" HorizontalAlignment="Left" Width="150"
                 ItemsSource="{Binding PcConfigurations, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseDoubleClick">
                                <cmd:EventToCommand Command="{Binding LocalConfigurationCommand}"
                                    CommandParameter="{Binding}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </TextBlock>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

When I run the application I got this error in the output:

System.Windows.Data Error: 40 : BindingExpression path error: 'LocalConfigurationCommand' property not found on 'object' ''PcConfiguration_0CC914504C64AE357F440BEA28C5F73FD3627331B5E407B6D7DD75076453D393' (HashCode=20396001)'. BindingExpression:Path=LocalConfigurationCommand; DataItem='PcConfiguration_0CC914504C64AE357F440BEA28C5F73FD3627331B5E407B6D7DD75076453D393' (HashCode=20396001); target element is 'EventToCommand' (HashCode=27147755); target property is 'Command' (type 'ICommand')

I guess it is because the current path that the

EventToCommand Command="{Binding LocalConfigurationCommand}"....

is looking for is set to the 'location' of what the listbox has set in its binding.

So I'd like to ask how can I put there location of my ViewModel, so it can find that command, but the location in CommandParameter={Binding} will still be current item from ListBox.


wpf wpf 
Updated on 19-Aug-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By