This is my ItemsControl code:
<ItemsControl Name="SearchItemsControl" ScrollViewer.CanContentScroll="True" ItemsSource="{Binding Path=SearchResult, IsAsync=True, UpdateSourceTrigger=Explicit}" Background="{StaticResource PopUpContentGradientBrush}" >
and yet this:
BindingExpression be = SearchItemsControl.GetBindingExpression(ItemsControl.ItemsSourceProperty);
returns null.
Why does it return null?
There is a high chance that you check it when the element is not loaded. To be sure you should test the code such as in a Loaded
event handler of the window:
//in the scope of your window class
Loaded += (s,e) => {
var be = SearchItemsControl
.GetBindingExpression(ItemsControl.ItemsSourceProperty);
//be should not be null now.
};
Also be sure that your Binding
is successful. Usually you can see the Output
window, it will notify any Binding related error there.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다