开发者

CollectionViewSource in CodeBehind with Template Bindings

开发者 https://www.devze.com 2022-12-14 04:46 出处:网络
I\'m creating a lookless control based on Selector in WPF with a Dependency Property named ListItems. When SelectedItems is changed, I do:

I'm creating a lookless control based on Selector in WPF with a Dependency Property named ListItems. When SelectedItems is changed, I do:

// CollectionViewSource ListItems = ...
ListItems.Source = newSelectedItems;
ListItems.Refresh();

And in my ControlTemplate I bind it to a ListBox like this:

<ListBox ItemsSource="{TemplateBinding ListItems}"/>

But no开发者_开发技巧 items appear in my ListBox.

I have also tried:

<ListBox ItemsSource="{Binding Source={TemplateBinding ListItems}}"/>

What am I missing here?

0

精彩评论

暂无评论...
验证码 换一张
取 消