I have a rather interesting case with ComboBox control - CustomComboBox;
In the style of this ComboBox, Popup contains one custom control that requests a DataContext;
<ctrl:CustomGrid DataContext="{TemplateBinding DataContext}" GridName="{Binding Preferences.CurrentGridName}"/>
The idea:
- to use this control several times on one page
- to use it in a masterpage container
- the masterpage control needs to have different DataContexts regarding the Page it is on
The logic:
- In the overriden OnApplyTemplate I am getting the grid and connecting few eventhandlers
The problem:
- The masterpage control is triggering OnApplyTemplate only once
- The first appearance of the CustomComboBox is as expected. However, every next apearance is with same DataContext, even when changing the datacontext of the CustomComboBox These changes don't reach to change my CustomGrid DataContext
I am sure that something on the bindings or the presentation logic is bad... Please throw some thoughts on, I would appreciate a hint here
Thanks