本文整理汇总了C#中System.Windows.Controls.GridViewColumnHeader.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# GridViewColumnHeader.SetBinding方法的具体用法?C# GridViewColumnHeader.SetBinding怎么用?C# GridViewColumnHeader.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.GridViewColumnHeader
的用法示例。
在下文中一共展示了GridViewColumnHeader.SetBinding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InnerListColumn
/// <summary>
/// Initializes a new instance of <see cref="InnerListColumn"/> class with the specified data description and visibility.
/// </summary>
/// <param name="dataDescription">The description of the data this column is bound to.</param>
/// <param name="isVisible">Whether the column is initially visible.</param>
/// <param name="createDefaultBinding">Whether the column should create a default binding using the specified data's property.</param>
public InnerListColumn(UIPropertyGroupDescription dataDescription, bool isVisible, bool createDefaultBinding)
{
if (dataDescription == null)
{
throw new ArgumentNullException("dataDescription");
}
GridViewColumnHeader header = new GridViewColumnHeader();
header.Content = dataDescription.DisplayContent;
header.DataContext = this;
Binding automationNameBinding = new Binding("DataDescription.DisplayName");
automationNameBinding.Source = this;
header.SetBinding(AutomationProperties.NameProperty, automationNameBinding);
this.Visible = isVisible;
this.Header = header;
this.DataDescription = dataDescription;
if (createDefaultBinding)
{
var defaultBinding = new Binding(GraphicalHostReflectionWrapper.EscapeBinding(dataDescription.PropertyName));
defaultBinding.StringFormat = GetDefaultStringFormat(dataDescription.DataType);
defaultBinding.ConverterCulture = CultureInfo.CurrentCulture;
this.DisplayMemberBinding = defaultBinding;
}
}