我对XAML和WPF的一些隐藏特性感到好奇?
我发现的一个是ListView的头单击事件
<ListView x:Name='lv'
Height="150"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler">
未列出GridViewColumnHeader.Click属性。
还有PresentationTraceSources.TraceLevel技巧来调试在任何特定场景中绑定的情况。你所要做的就是在WindowsBase程序集中引用System.Diagnostics命名空间
xmlns:sd="clr-namespace:System.Diagnostics;assembly=WindowsBase"
然后将以下内容添加到绑定表达式中:
<TextBlock Text="{Binding Message, sd:PresentationTraceSources.TraceLevel=High}" />
日志将如下所示:
System.Windows.Data Warning: 52 : Created BindingExpression (hash=5923895) for Binding (hash=7588182)
System.Windows.Data Warning: 54 : Path: 'Message'
System.Windows.Data Warning: 56 : BindingExpression (hash=5923895): Default mode resolved to OneWay
System.Windows.Data Warning: 57 : BindingExpression (hash=5923895): Default update trigger resolved to PropertyChanged
System.Windows.Data Warning: 58 : BindingExpression (hash=5923895): Attach to System.Windows.Controls.TextBlock.Text (hash=65248697)
System.Windows.Data Warning: 63 : BindingExpression (hash=5923895): Resolving source
multibinding(与StringFormat组合):
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}, {1}">
<Binding Path="LastName" />
<Binding Path="FirstName" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>