Can't render custom UserControl in Unreal engine
Hi, I'm fairly new to using Noesis so I might be missing something obvious but I've gone over the samples and getting started guides and haven't been able to find what I'm doing wrong.
If I create a simple user control:
I am able to render it in Unreal engine directly by adding it to viewport in my blueprint like so:
However, if I try to nest in inside of another Xaml file:
Then "Test" will render but not the SimpleUserControl. I also receive a warning in Unreal engine:
Are there other steps to get a custom user control to render in Unreal engine? For reference, I'm using UE 5.1 and Noesis 3.2.1.
Thanks in advance.
If I create a simple user control:
Code: Select all
using System.Windows.Controls;
namespace Ghana_Blend
{
public partial class SimpleUserControl : UserControl
{
public SimpleUserControl()
{
InitializeComponent();
}
}
}
Code: Select all
<UserControl x:Class="Ghana_Blend.SimpleUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ghana_Blend"
mc:Ignorable="d">
<Grid>
<Rectangle Width="100" Height="100" Fill="#FFBD2FB1"></Rectangle>
</Grid>
</UserControl>
However, if I try to nest in inside of another Xaml file:
Code: Select all
<Page x:Class="Ghana_Blend.GameOverlay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ghana_Blend" d:DataContext="{d:DesignInstance Type=local:GameOverlayViewModel}"
mc:Ignorable="d"
Title="GameOverlay">
<Grid>
<TextBlock Text="Test" Foreground="White"/>
<local:SimpleUserControl></local:SimpleUserControl>
</Grid>
</Page>
Code: Select all
LogNoesis: Warning: /Game;component/Ghana_Blend/GameOverlay.xaml(215,9): Unknown element type 'local:SimpleUserControl' (Ghana_Blend.SimpleUserControl)
Thanks in advance.
-
sfernandez
Site Admin
- Posts: 3008
- Joined:
Re: Can't render custom UserControl in Unreal engine
Hello,
As explained in Unreal's tutorial, classes that appear in the XAML have to be registered so they can be created using the component factory.
Also remember as indicated in the tutorial to call Noesis::GUI::LoadComponent() in order to load the XAML associated to your UserControl.
Let us know if you find any trouble with that.
As explained in Unreal's tutorial, classes that appear in the XAML have to be registered so they can be created using the component factory.
Also remember as indicated in the tutorial to call Noesis::GUI::LoadComponent() in order to load the XAML associated to your UserControl.
Let us know if you find any trouble with that.
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 4 guests