Click here to Skip to main content
15,883,801 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My HelixViewport3D is in the mainwindow. And I want to add children from UserControl to HelixViewport3D in MainWindow in WPF C# so please help me 


What I have tried:

C#
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        // Get the UserControl instance
        UserControl1 uc = (UserControl1)MainGrid.FindName("MyUserControl");

        // Add the UserControl to the HelixViewport3D as a child
        helixViewport3D.Children.Add(uc);
    }
}
Posted
Comments
Graeme_Grant 11-Feb-23 3:07am    
This is a 3rd-party control. Best place to ask is their support: Issues · helix-toolkit/helix-toolkit · GitHub[^]
[no name] 11-Feb-23 13:18pm    
If you're using "FindName", it presumes it "has a name", and if it's not a template, it begs the question, why are you using "FindName" and not "the name" to reference the control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900