本文整理汇总了C#中System.Windows.Controls.GridViewColumnHeader.UpdateProperty方法的典型用法代码示例。如果您正苦于以下问题:C# GridViewColumnHeader.UpdateProperty方法的具体用法?C# GridViewColumnHeader.UpdateProperty怎么用?C# GridViewColumnHeader.UpdateProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.GridViewColumnHeader
的用法示例。
在下文中一共展示了GridViewColumnHeader.UpdateProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateHeaderProperty
private void UpdateHeaderProperty(
GridViewColumnHeader header, // the header need to update
DependencyProperty targetDP, // the target DP on header
DependencyProperty columnDP, // the DP on Column as 1st source, can be Null
DependencyProperty gvDP // the DP on GridView as 2nd source
)
{
if (gvDP == ColumnHeaderContainerStyleProperty
&& header.Role == GridViewColumnHeaderRole.Padding)
{
// Because padding header has no chance to be instantiated by a sub-classed GridViewColumnHeader,
// we ignore GridView.ColumnHeaderContainerStyle silently if its TargetType is not GridViewColumnHeader (or parent)
// I.e. for padding header, only accept the GridViewColumnHeader as TargetType
Style style = ColumnHeaderContainerStyle;
if (style != null && !style.TargetType.IsAssignableFrom(typeof(GridViewColumnHeader)))
{
// use default style for padding header in this case
header.Style = null;
return;
}
}
GridViewColumn column = header.Column;
object value = null;
if (column != null /* not the padding one */
&& columnDP != null /* Column doesn't has ContextMenu property*/)
{
value = column.GetValue(columnDP);
}
if (value == null)
{
value = this.GetValue(gvDP);
}
header.UpdateProperty(targetDP, value);
}