Bug 28568 - BindingContext is not propagated to items that are contained inside ResourceDictionary
Summary: BindingContext is not propagated to items that are contained inside ResourceD...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.0
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-30 18:28 UTC by Alexander Vostres
Modified: 2016-04-08 19:19 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Demo project (181.36 KB, application/x-zip-compressed)
2015-03-31 15:56 UTC, Alexander Vostres
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Alexander Vostres 2015-03-30 18:28:49 UTC
Title pretty much describes it.
I have following markup:
<ContentPage.Resources>
  <ResourceDictionary>
    <extensions:CollectionGroupingSource CollectionSource="{Binding ItemsSource}" x:Name="CollectionSource"/>
  </ResourceDictionary>
</ContentPage.Resources>

Where CollectionGroupingSource mimics part of CollectionViewSource functionality from WPF. When I tried running this markup I noticed that CollectionSource is never set. This was fixed by adding following code to the page:

protected override void OnBindingContextChanged()
{
    base.OnBindingContextChanged();
    this.CollectionSource.BindingContext = BindingContext;
}
Comment 1 Parmendra Kumar 2015-03-31 14:16:42 UTC
I have tried to reproduce this issue but I am not able to reproduce it. 
Could you please provide us a sample project, Application Output Log ? So that  we can reproduce it at our end.

Environment info:

Xamarin Studio  5.8.2 (build 7)
Mono 3.12.1 ((detached/b63df7d)
Xcode 6.2 (6776)
Xamarin.iOS : 8.8.1.9 (Business Edition)
Xamarin.Android : 4.20.1.0 (Business Edition)
Xamarin.Mac: 1.12.0.14 (Business Edition)
Mac OS X 10.9.4
Comment 2 Alexander Vostres 2015-03-31 15:56:04 UTC
Created attachment 10577 [details]
Demo project

Please have a look at Absio.XForms\Views\DemoView.xaml.cs
When commenting out line "CollectionSource.BindingContext = BindingContext;" the screen will be empty.
I tested this on Android builds.
Comment 3 Chris King 2016-04-08 19:19:32 UTC
Alex, apologies for taking taking so long to get back to you. We're closing out old issues. I tried compiling the reproduction but got the following errors. Please resubmit if you are still having this issue.

1>C:\Users\kingc\Downloads\absio.test\absio.test\Absio.XForms\Absio.XForms.cs(1,13,1,23): error CS0234: The type or namespace name 'ViewModels' does not exist in the namespace 'Absio' (are you missing an assembly reference?)
1>C:\Users\kingc\Downloads\absio.test\absio.test\Absio.XForms\Extensions\DemoExtension.cs(5,13,5,23): error CS0234: The type or namespace name 'ViewModels' does not exist in the namespace 'Absio' (are you missing an assembly reference?)
1>C:\Users\kingc\Downloads\absio.test\absio.test\Absio.XForms\Views\DemoView.xaml.cs(7,13,7,23): error CS0234: The type or namespace name 'ViewModels' does not exist in the namespace 'Absio' (are you missing an assembly reference?)

Warm regards,
XFT