I have a ListView that allows the user to change the ViewBase through a Context Menu (it acts like a simplified version of windows explorer).
<ListView Name="lv" Grid.Row ="0" Grid.Column ="1" >
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="View1" Click="SwitchViewMenu"/>
<MenuItem Header="View2" Click="SwitchViewMenu"/>
</ContextMenu>
</ListView.ContextMenu>
<ListView.View>
<local:View1 />
</ListView.View>
</ListView>
The ViewBases DataTemplates are defined in a Generic.XAML file, and i use the following Function to change the chosen view :
void ChangeView(string str)
{
if (str == "View1")
{
lv.View = lv.FindResource("View1") as ViewBase;
}
else if (str == "View2")
{
lv.View = lv.FindResource("View2") as ViewBase;
}
}
The problem:
I got a custom CheckBox control in all the DataTemplates, that has a predefined click event attached, however when i try to move up the Parents of the CheckBox, the highest level i can reach is the Parenting Grid in the DataTemplate in use.
What i need to access is the Parent Window itself.
Note: I tried to add a Dependency Property to the Custom CheckBox Control and bind it to an extra defined variable in the sent object (The data template's items DataType object) that had a window reference as its value, but i kept getting null even though all the other dependency properties/values got bound.