<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.T开发者_运维百科woWay
});
}
}
}
You would need to add your GridViewExportOptions
as a logical child. Effectively, your GridViewExportOptions
would have to derive from FrameworkElement
. When your property is changed, you'd have to AddLogicalChild on your GridView
(and RemoveLogicalChild to remove the old value, if any). Then you'd have to override LogicalChildren on your GridView
and include your option.
You would need to do this in your GridViewExportOptions
class as well, with respect to it's "children".
精彩评论