# Custom node for launching a window with a user interface

**URL:** <https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759>\
**Category:** Developers\
**Tags:** ui, dynamo, userinterface\
**Created:** [February 5, 2023, 12:22am UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759 "2023-02-05T00:22:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![David.Malinovsky](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@David.Malinovsky](https://forum.dynamobim.com/u/David.Malinovsky)\
**Post date:** [February 5, 2023, 12:22am UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/1 "2023-02-05T00:22:47Z")

</div>

Hi all,  
I’m trying to create note, that opens a new window with user interface. I have achieved the desired result, but the node has an input parameter, that I didn’t set. I just started learning C#. Tell me please, is it possible to get rid of unnecessary input parameters?

Code for window with user interface

```auto
using System.Windows;

namespace TestNodes
{
    /// <summary>
    /// TestUI.xaml
    /// </summary>
    public partial class TestUI : Window
    {
        public TestUI()
        {
            InitializeComponent();
        }

        private void ok_buttom_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void cencel_buttom_Click(object sender, RoutedEventArgs e)
        {
            DialogResult=false;
            Close();
        }
    }

```

Code of the method, that launches the window with the user interface.

```auto
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestNodes
{
    public class UserInterface
    {
        public List<Object> UI_Interface()
        {
            List<Object> ListReturn = new List<Object>();
            TestUI window = new TestUI();

            var res = window.ShowDialog();
            if (!res.HasValue && res.Value)
                window.Close();

            ListReturn.Add(window.textbox.Text);
            return ListReturn;
        }

    }
}

```

This node in Dynamo.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/5/b546b5867b3757b4d4431738f165013025a94b5e.png)

I have studied a lot of information and have not found a way to get rid of this parameter, please help me.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 5, 2023, 7:42pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/2 "2023-02-05T19:42:42Z")

</div>

@David.Malinovsky ,

i did some stuff in python

> [@Interface with IronPython, how?](https://forum.dynamobim.com/t/interface-with-ironpython-how/56175/7):
>
> thats pur magic! Thank you ! I`ll be back slight_smile

---

<div class="post-metadata">

**Author:** ![David.Malinovsky](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@David.Malinovsky](https://forum.dynamobim.com/u/David.Malinovsky)\
**Post date:** [February 6, 2023, 5:15am UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/3 "2023-02-06T05:15:29Z")

</div>

Yes, I have seen, that it is possible to implement UI in python. But my goal now is to implement UI in C#.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 6, 2023, 12:47pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/4 "2023-02-06T12:47:26Z")

</div>

@David.Malinovsky ,

> [@C# CSharp in Dynamo](https://forum.dynamobim.com/t/c-csharp-in-dynamo/28689):
>
> Hello guys, I am trying to link a C# Script into my Dynamo Script. Now I tried the example based on this post: But for me it didnt work. What am I doing wrong? is it possible that this one is a too old node? (this post was in 2016). Are there any new experiences with C# within Dynamo? Any help would be appreciated. thanks a lot! I exactly did what they did in this post. But the node everytime just gives error messages.

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [February 6, 2023, 5:43pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/5 "2023-02-06T17:43:47Z")

</div>

Is your goal to learn C# and if so, what is dynamo giving you that C# wouldn’t?  
Dynamo, Python and pyRevit all play nicely together.  
pyRevit plays nicely with .vbs and cs.  
C# is big and bad, and can do it all by itself.

If you are heading into C#, I’d just jump into that for the whole app. A learning curve for sure, but probably simpler in the end more robust. Just a heads up, deployment and maintenance of C# as a Revit add-in is a pita for a small office.

But if you are just after a nice basic UI stuff - you can’t beat pyRevit’s forms. Robust and simple to implement.

---

<div class="post-metadata">

**Author:** ![David.Malinovsky](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@David.Malinovsky](https://forum.dynamobim.com/u/David.Malinovsky)\
**Post date:** [February 6, 2023, 6:23pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/6 "2023-02-06T18:23:33Z")

</div>

I understand what you’re talking about. But it’s just a piece of something bigger. It is important to me that the UI is implemented as a node for Dynamo created in C#.

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [February 6, 2023, 6:48pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/7 "2023-02-06T18:48:13Z")

</div>

> [@David.Malinovsky](#):
>
> Yes, I have seen, that it is possible to implement UI in python. But my goal now is to implement UI in C#.

Sample Github repo of how to create a window in C# here:

> **[GitHub - johnpierson/DynamoSampleWPFWindow: This is a sample of how to make a...](https://github.com/johnpierson/DynamoSampleWPFWindow)**
>
> This is a sample of how to make a WPF window in a zero touch node. - GitHub - johnpierson/DynamoSampleWPFWindow: This is a sample of how to make a WPF window in a zero touch node.

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [February 6, 2023, 7:44pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/8 "2023-02-06T19:44:41Z")

</div>

So, that is a zero-touch node you’ve created?  
And you’ve taken a look at this?  
[Revit Add-Ons: Video: Creating a Dynamo User Interface (UI) with XAML and C# (revitaddons.blogspot.com)](http://revitaddons.blogspot.com/2017/03/video-creating-dynamo-user-interface-ui.html)

---

<div class="post-metadata">

**Author:** ![David.Malinovsky](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@David.Malinovsky](https://forum.dynamobim.com/u/David.Malinovsky)\
**Post date:** [February 6, 2023, 7:47pm UTC](https://forum.dynamobim.com/t/custom-node-for-launching-a-window-with-a-user-interface/85759/9 "2023-02-06T19:47:01Z")

</div>

This is what I was looking for. Thank you very much! You have helped me a lot!

The solution to the problem was in one line

```auto
        public TestUI()
        {
            InitializeComponent();
            DataContext = this;
        }

```
