Is Parent binding supported?
Hello,
recently I've ran into issue with binding commands to a button. I used binding to Parent which works just fine in WPF, but under Unity it is not.
I wanted to ask if this feature is supported, since I couldn't find it here: https://www.noesisengine.com/docs/3.0/G ... nding.html
It says in the documentation that RelativeSource binding should work, so I was curious if Path might be the issue here.
Note: I could always move that command to current DataContext and avoid binding to a parent. Tho I would like to know reasoning behind as to why it is not working this way.
Thanks for any insight on this.
recently I've ran into issue with binding commands to a button. I used binding to Parent which works just fine in WPF, but under Unity it is not.
I wanted to ask if this feature is supported, since I couldn't find it here: https://www.noesisengine.com/docs/3.0/G ... nding.html
It says in the documentation that RelativeSource binding should work, so I was curious if Path might be the issue here.
Code: Select all
Command="{Binding Parent.DataContext.OpenHomeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
Thanks for any insight on this.
-
sfernandez
Site Admin
- Posts: 2995
- Joined:
Re: Is Parent binding supported?
Hi, that kind of binding should work, I just made the following simple test and the result was as expected a Red rectangle:
I will need a bit more of context to that binding to see if there is a situation where this is failing in Noesis, could you please create a ticket in our bugtracker and attach the xamls involving that binding?
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid.Resources>
<GradientStop x:Key="stop1" Offset="123" Color="Red"/>
<GradientStop x:Key="stop2" Offset="123" Color="Blue"/>
</Grid.Resources>
<Border DataContext="{StaticResource stop1}" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel DataContext="{StaticResource stop2}">
<Rectangle Width="300" Height="100">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding Parent.DataContext.Color, RelativeSource={RelativeSource AncestorType={x:Type StackPanel}}}"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Border>
</Grid>
Re: Is Parent binding supported?
I will post that ticket, sorry for the lack of context here.
-
sfernandez
Site Admin
- Posts: 2995
- Joined:
Re: Is Parent binding supported?
Thanks for the detailed report #2055
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 3 guests