我正在动态地将xaml文件加载到我的程序中,该程序具有绑定:
<ListView
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Grid.Row="2" BorderBrush="White" Name="ListView1"
ItemsSource="{Binding Path=line}" HorizontalAlignment="Stretch">
<ListView.View>
<GridView>
<GridViewColumn Header="Lines"
DisplayMemberBinding="{Binding Path=aline}" />
</GridView>
</ListView.View>
</ListView >
Run Code Online (Sandbox Code Playgroud)
在我的程序中,我想检查Binding是否存在.
应该如何实现?
编辑:这aline是DataContext对象的属性
LPL*_*LPL 11
你可以检查这样的绑定:
BindingExpression be = BindingOperations.GetBindingExpression(ListView1, ItemsSourceProperty);
return be != null ? "ItemsSource is bound" : "ItemsSource is not bound";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4529 次 |
| 最近记录: |