Binding failed when re-routing Content Property of UserControl
Hey folks,
I am trying to re-route the content of a usercontrol to a custom dependency property and bind it to my own contentpresenter.
As far as I am aware I'm doing it the intended way, as stated here in the binding documentation: https://www.noesisengine.com/docs/Gui.C ... orial.html
Could it be that the re-routing is an issue or am I just dense right now?
The error:
Here's my very basic XAML:
And the respective code behind:
I am trying to re-route the content of a usercontrol to a custom dependency property and bind it to my own contentpresenter.
As far as I am aware I'm doing it the intended way, as stated here in the binding documentation: https://www.noesisengine.com/docs/Gui.C ... orial.html
Could it be that the re-routing is an issue or am I just dense right now?
The error:
Code: Select all
[NOESIS] Binding failed: Path=InnerContent, Source=Testing.DetailsPanel('Root'), Target=ContentPresenter('_InnerContentPresenter'), TargetProperty=ContentControl.Content
UnityEngine.Debug:LogError (object,UnityEngine.Object)
[NOESIS] Can't solve PropertyPath: Type 'Testing.DetailsPanel' does not contain a property named 'InnerContent' // <----- as far as I am aware, it does?
Code: Select all
<UserControl x:Class="Testing.DetailsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Root">
<!-- Root Grid That Has The Base Texture As Background -->
<Grid x:Name="_RootGrid"
Margin="8"
Width="400"
Height="600">
<Grid.Background>
<!--<ImageBrush Source="" />-->
<SolidColorBrush Color="#FFFFFF" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<!-- LOGO -->
<RowDefinition Height="*" />
<!-- CONTENT -->
</Grid.RowDefinitions>
<ContentPresenter x:Name="_InnerContentPresenter"
Content="{Binding InnerContent, ElementName=Root}"
Grid.Row="1" />
</Grid>
</UserControl>
Code: Select all
#if UNITY_5_3_OR_NEWER
#define NOESIS
using Noesis;
#else
using System.Windows;
using System.Windows.Controls;
#endif
namespace Testing
{
[ContentProperty(nameof(InnerContent))]
public partial class DetailsPanel: Noesis.UserControl
{
public static readonly DependencyProperty InnerContentProperty =
DependencyProperty.Register(nameof(InnerContent), typeof(object), typeof(DetailsPanel), new PropertyMetadata(null));
public object InnerContent
{
get { return GetValue(InnerContentProperty); }
set { SetValue(InnerContentProperty, value); }
}
public DetailsPanel()
{
InitializeComponent();
}
#if NOESIS
private void InitializeComponent()
{
NoesisUnity.LoadComponent(this);
}
#endif
};
}
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: Binding failed when re-routing Content Property of UserControl
It is weird, I tried your user control (xaml + cs) in Noesis 3.2.4 and it works as expected without any binding warning and showing whatever elements I set in the InnerContent property.
What version of Noesis are you using?
What version of Noesis are you using?
Who is online
Users browsing this forum: Ahrefs [Bot] and 4 guests