---
title: "Resetting binding&#39;s source in wpf"  
description: "Resetting binding&#39;s source in wpf"  
author: "Anonymous User"  
published: 2014-08-19  
updated: 2014-08-19  
canonical: https://www.mindstick.com/forum/2060/resetting-binding-39-s-source-in-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# Resetting binding&#39;s source in wpf

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](https://www.mindstick.com/articles/12824/calculator-application-in-android) I got this [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) in the [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular):

```
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](https://www.mindstick.com/articles/44333/4-expert-tips-on-how-to-pick-the-right-career-path) that the

EventToCommand [Command](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net)="{[Binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) LocalConfigurationCommand}"....

is looking for is set to the '[location](https://www.mindstick.com/blog/11636/relocating-business-or-office-to-another-location)' of what the [listbox](https://www.mindstick.com/articles/626/listbox-events-in-c-dot-net) has set in its binding.

So I'd like to ask how can I put there location of my [ViewModel](https://www.mindstick.com/forum/157215/what-is-viewmodel-in-mvc), so it can find that command, but the location in CommandParameter={Binding} will still be current [item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript) from ListBox.

## Replies

### Reply by Pravesh Singh

The viewmodel is in fact the ListBox's data context, and you can get to the ListBox by using RelativeSource:

<cmd:EventToCommand Command="{Binding Path=DataContext.LocalConfigurationCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"

CommandParameter="{Binding}"/>


---

Original Source: https://www.mindstick.com/forum/2060/resetting-binding-39-s-source-in-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
