KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The problem is that RelativeSource does not work in the following case. I use silverlight 5. //From MainPage.xaml <Grid x:Name="LayoutRoot" Background="White" Height="100" Width="200"> <Popup IsOpen="True"> <TextBlock Text="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType=Grid}}" /> </Popup> </Grid> //From MainPage.xaml.cs public MainPage() { InitializeComponent(); DataContext = "ololo"; } If I set a breakpoint on the binding, I'll get Error: System.Exception: BindingExpression_CannotFindAncestor. If I use ElementName=LayoutRoot instead of RelativeSource , everything will be OK. Why does the relative source binding not work?
Tags (comma-separated)
Save Edits
Cancel