dotnet / dotnet/wpf

CollectionContainer does not support RelativeSource

Open
#3,420 0 comments 1 reaction 0 assignees View on GitHub
Enhancement Requested
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

I'm interested if the bug discussed in this other post has been fixed, or if not is it tracked as an open item somewhere else?

https://social.msdn.microsoft.com/Forums/en-US/b15cbd9d-95aa-47c6-8068-7ae9f7dca88a/collectioncontainer-does-not-support-relativesource?forum=wpf

The original description was:

> I've discovered that I cannot assing a relative binding to a CollectionContainer.Collection dependency property:
>
> Code Snippet
> ```
>
>
>
>
> // binding works
>
>
>
> // binding fails ("cannot find source ...")
>
>
>
>
>
>
> ```
>
>
> I guess that this behaviour is because CollectionContainer does not derive from FrameworkElement, therefore the CollectionContainer not being part of the visual tree.
>
> Are there any workarounds, other than writing a Wrapper (which is what I intend to do)?
>
> Tuesday, August 21, 2007 5:13 PM

(written by Kuno Meyer.)

There was also this reply:

> You're right on almost all counts. We should fix this. I've opened a bug.
>
> The only place I differ with you is whether CollectionContainer should derive from FrameworkElement. It doesn't need to, provided that the data binding engine can discover its "governing FrameworkElement". This works for Freezables, for example, which do not derive from FE. The same mechanism should be applied to CollectionContainer.
>
> Thanks for the report.
>
> Monday, August 27, 2007 10:59 PM
> Sam Bent - MSFT

The most recent comment on that post was in June 2017 claiming that the problem was not yet fixed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.