ElementName binding not working

Topics: Prism v1
Jul 28, 2009 at 1:33 PM
Edited Jul 28, 2009 at 4:15 PM

Hi everyone,


I'm using Prism V1 in a WPF project. It's working great but I have a binding issue. Here are some explanations :

We are developing UserControls. These UserControls are loaded as views of the main shell region. In these controls  we have a basic control which inherits ContentControl which acts as a MasterPage and uses Templates to set the basic layout.



<commons:BaseView x:Class="MynameSpace.MyView"
xmlns:cal="http://www.codeplex.com/CompositeWPF" Height="Auto" Width="Auto">

<commons:BaseUFMaster x:Name="RootControl" UFOrientation="Vertical" ViewType="Mixed">

<commons:ToolBar x:Name="ToolBar" Height="30" />

<TabControl cal:RegionManager.RegionName="DetailRegion">
<TabItem Header="MyHeader">
<TextBox x:Name="TextBox1"/>
<TextBlock Text="{Binding ElementName=TextBox1, Path=Text" />


My Problem is that the Binding on the TextBlock is not working. It says that the source element can not be found. If I remove the RegionName set on the TabControl it works perfectly.

Is there anything I can do? Is it a bug?


Thanks in advance to anyone who will take his or her time to answer :)


Edit : Actually I don't really know if the problem comes from Prism. Maybe someone already had this kind of problem and could help me...

Edit 2 : I tried to port my project to Prism V2 and it seems that the ElementName binding is working. However I have other issues with the new release. My region is missing from my regionManager and I haven't found out why for the moment.

Edit 3 : I managed to get everything work using Prism V2 (using some CodeBehind). The sad part is that ElementName binding does not work for objects in collections declared in xaml... If someone can tell me what to do to make this work using Prism V1 he is still welcome.