My special XListBox inherits from RadListBox. And since its item containers need special functionality too, I do the following:
However, this breaks the selection functionality of my XListBox - at least the part related to mouse clicks. Looking at the implementation of RadListBox I see the following:
Ok, I see! I need to set the SelectionHelper. BUT - AND THIS IS SOMETHING I DON'T UNDERSTAND - the "SelectionHelper"-property is an INTERNAL part of ListItem and cannot be set in my code. Why? This means that everybody with a special items container needs to implement selection functionality himself. In my opinion this doesn't make sense. Can you explain me the reasons behind this.
For the moment I set the "SelectionHelper"-property via reflection. While this works, it doesn't seem like a perfect or durable solution.
Any other ideas?
Cheers,
Stephan
protected override DependencyObject GetContainerForItemOverride()
{
return new XListBoxItem(this);
}
However, this breaks the selection functionality of my XListBox - at least the part related to mouse clicks. Looking at the implementation of RadListBox I see the following:
protected override DependencyObject GetContainerForItemOverride()
{
RadListBoxItem radListBoxItem = new RadListBoxItem();
radListBoxItem.SelectionHelper = this.SelectionHelper;
radListBoxItem.ParentSelector = (ListControl) this;
return (DependencyObject) radListBoxItem;
}
Ok, I see! I need to set the SelectionHelper. BUT - AND THIS IS SOMETHING I DON'T UNDERSTAND - the "SelectionHelper"-property is an INTERNAL part of ListItem and cannot be set in my code. Why? This means that everybody with a special items container needs to implement selection functionality himself. In my opinion this doesn't make sense. Can you explain me the reasons behind this.
For the moment I set the "SelectionHelper"-property via reflection. While this works, it doesn't seem like a perfect or durable solution.
Any other ideas?
Cheers,
Stephan