I came across this website and was able to create a XAML window working from within Python Node. I am still exploring the implementation so it can be useful in Dynamo environment. Perhaps something like Datashape nodes but with WPF window instead of Windows Forms.
I have attached the dyn and the xaml in here. The window opens and the command works, however when I close this window, the entire Revit closes. I am sure the close event is somewhat tied with the Revit close event. I am wondering if someone would help me understand how I can register this window as a child of Revit so when I close it, it exit without closing Revit.
[MVVM.dyn (5.1 KB) ]
Copy and paste into a text file and rename it to WpfMvvmDemo.xaml. Also in the Python script please edit the path to this file so it is found by the script.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="IronPython MVVM Demo"
Width="450"
SizeToContent="Height">
<Grid Margin="15" x:Name="grid1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" FontSize="24" Content="First Name:" />
<Label Grid.Row="0" Grid.Column="1" FontSize="24" Content="{Binding FirstName}" />
<Label Grid.Row="1" Grid.Column="0" FontSize="24" Content="Surname:" />
<Label Grid.Row="1" Grid.Column="1" FontSize="24" Content="{Binding Surname}" />
<Button Grid.Row="2" FontSize="24" Content="Change" Command="{Binding ChangeCommand}" />
</Grid>