<k:GridView Name="_masterGridView"
ItemsSource="{Binding ProductLocationList}"
SelectedItem="{Binding ProductLocationSelected}">
<!-- DataContext does not propagate here automatically in user control... why? -->
<k:GridView.ExportOptions>
<k:GridViewExportOptions Title="Production Location Management">
<k:SearchCriteria >
<k:SearchCriterion Title="End Date"
Value="{Binding SearchEndDate}"
ValueFormat="g" />
</k:SearchCriteria>
</k:GridViewExportOptions>
</k:GridView.ExportOptions>
<!-- to here -->
I have to do this hack and it only propagates to GridViewExport option
The hack is in the GridView class…
public GridViewExportOptions ExportOptions
{
get { return _exportOptions; }
set
{
_exportOptions = value;
if (value != null)
{
ExportOptions.SetBinding(FrameworkContentElement.DataContextProperty,
new Binding("DataContext")
{
Source = this,
Mode = BindingMode.TwoWay
});
}
}
}
You would need to add your
GridViewExportOptionsas a logical child. Effectively, yourGridViewExportOptionswould have to derive fromFrameworkElement. When your property is changed, you’d have to AddLogicalChild on yourGridView(and RemoveLogicalChild to remove the old value, if any). Then you’d have to override LogicalChildren on yourGridViewand include your option.You would need to do this in your
GridViewExportOptionsclass as well, with respect to it’s “children”.