OT: Databinding in a context menu

OT: Databinding in a context menu

Old forum URL: forums.lhotka.net/forums/t/5550.aspx


ajj3085 posted on Tuesday, October 07, 2008

Hi,

Trying to solve a problem I'm having with WPF's databinding.  I have the following xaml:

<UserControl x:Class="PartListView">
    <DataGrid>
       <DataGrid.ContextMenu>
             <ContextMenu>
                    <MenuItem Header="{Path=Name, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type invwpf:PartListView}}}" />
             </ContextMenu>
       </DataGrid.ContextMenu>
    </DataGrid>
</UserControl>

Using some debugging, it looks like the FindAncestor never gets past the context menu when looking for ancestors.  Any ideas how I can get this working?

Thanks
Andy

Copyright (c) Marimer LLC