15 votes
closed
TabControlRegionAdapter bindings in the tab header are broken under silverlight 3.0

Description

 
This used to work fine under SL3 beta, but after I upgraded to SL3 RTM, the functionality stopped working.
In order to reproduce, just open and compile the ViewInjectionComposition solution in Quick starts. the tab header that used to display "Current Projects", now is empty.

File Attachments


Closed Nov 3 at 7:27 PM  by dschenkelman

This issue was fixed in the Prism-v2.1 release, so the Workitem is closed now. Prism 2.1 can be downloaded from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=387c7a59-b217-4318-ad1b-cbc2ea453f40&displaylang=en


Comments

most recent at top (show oldest at top)
dschenkelman wrote Nov 3 at 7:26 PM
This issue was fixed in the Prism-v2.1 release, so the Workitem is closed now. Prism 2.1 can be downloaded from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=387c7a59-b217-4318-ad1b-cbc2ea453f40&displaylang=en

brumfb wrote Aug 21 at 10:36 PM
We've starting work to address these for SL3 and I've posted a drop of what we have to-date that includes an updated TabControlRegionAdapter for this issue. You can find tis in the source under V3.

mgcain wrote Jul 27 at 6:37 PM
I have another workaround until this is fixed properly -

In the TabControlRegionAdapter PrepareContainerForItem method, I inserted the line Fred showed above into the method, after the container.Style was set. So after the line:

container.Style = GetItemContainerStyle(parent);
I added:
container.Header = container.HeaderTemplate.LoadContent();

This performs the databinding and will set the headers from the binding on the presenter...

Its a hack, but it will work until the right answer is posted...

FredHirschfeld wrote Jul 22 at 3:03 PM
I just dug into what is causing the problem and it is a flaw in Silverlight 3 unfortunately. SL 2 worked correctly as the UpdateHeaderVisuals correctly set the template by loading the content:

ContentControl contentControl = this.GetContentControl(this.IsSelected, this.TabStripPlacement);
if (contentControl != null)
{
if (this.HeaderTemplate == null)
{
contentControl.Content = this.Header;
}
else
{
FrameworkElement element = this.HeaderTemplate.LoadContent() as FrameworkElement;
contentControl.Content = element;
}
}

SL3 just sets the ContentTemplate of the header control to the HeaderTemplate which I don't think performs the data binding.

I verified this by manually loading the TabItem.Header with the evaluation of its HeaderTemplate.LoadContent(). Probably the best way to workaround this problem is to create your own derived TabItem control to correct the problem by adding an additional step to the ApplyTemplate AND copy the TabControlRegionAdaptor to use your new derived TabItem control.

I have not tested this yet but will post something when I have it working.

mgcain wrote Jul 22 at 1:13 PM
I've been beating my head against the wall on this for a couple of days - anyone have a workaround?

FredHirschfeld wrote Jul 17 at 4:23 PM
I noticed this myself the other day and checked that using simple text in a template style for the TabItem.HeaderTemplate does show BUT when using {Binding SomeProperty} it is blank.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2009.10.27.15987