Probably a noobish question, but here it is:

```
<StackPanel Orientation="Horizontal">
    <TextBox x:Name="InsName" Margin="3" Width="180"/>
    <Button Command="cc:MyCommands.AddObject" CommandParameter="{Binding ElementName=InsName, Path=Text}" >Ok</Button>
</StackPanel>

```

Can someone explain why the CommandParameter that is sent when the button is clicked is always NULL? How do I bind a parameter to a property of another element correctly?

Thanks in advance!

PS: bigger portion of the code, just to give some context (all the code works perfectly except the porion I showed above)

```
<TreeView.ItemTemplate>
            <HierarchicalDataTemplate ItemsSource="{Binding Children}">
                <StackPanel Orientation="Horizontal" AllowDrop="{Binding IsGroupNode}" Drop="NodeDrop" DragEnter="NodeOver" DragLeave="NodeLeave">
                    <CheckBox Click="nodeChecked" IsChecked="{Binding IsChecked, Mode=TwoWay}" Visibility="{Binding IsObjectNode, Converter={StaticResource bool2vis}}" />
                    <TextBlock Text="{Binding Text}" Foreground="{Binding TextColor}" PreviewMouseLeftButtonDown="startDragging">
                        <TextBlock.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Add Item">
                                    <StackPanel Orientation="Horizontal" IsEnabled="{Binding IsGroupNode}">
                                        <TextBox Name="InsName" Margin="3" Width="180"/>
                                        <Button Command="cc:MyCommands.AddObject" CommandParameter="{Binding ElementName=InsName, Path=Text}" Height="22" Width="30" IsDefault="True">Ok</Button>
                                    </StackPanel>
                                </MenuItem>
                                <MenuItem Header="Remove" Command="cc:MyCommands.RemoveObject" />
                                <Separator />
                                <MenuItem Command="cc:MyCommands.UncheckAll" IsEnabled="{Binding IsGroupNode}" />
                            </ContextMenu>
                        </TextBlock.ContextMenu>
                    </TextBlock>
                </StackPanel>
            </HierarchicalDataTemplate>
        </TreeView.ItemTemplate>

```