I've looked at the other custom control creation questions on here, as well as other online resources, but I'm lost as to how to create a custom control that doesn't require a C# code-behind file. Since my project is pure IronPython, I don't know how I would integrate the C# code behind with it.
What I'm trying to do isn't even that complicated; no messy styling or render transformations or anything. I'm merely trying to create a composite control of a bunch of existing ones I have, so that I can add/remove these composite controls procedurally. For example, I have this GroupBox:
As you can see, it's just a GroupBox with a TextBox and a ComboBox in the Header, with its body populated by a UniformGrid containing some CheckBoxes. Here is the XAML:
<GroupBox Name="DO1">
<GroupBox.Header>
<DockPanel>
<TextBlock VerticalAlignment="Center">DO1</TextBlock>
<ComboBox Name="DO1DeviceList" Margin="3 0 0 0" ItemsSource="{Binding DOtable}">
</ComboBox>
</DockPanel>
</GroupBox.Header>
<UniformGrid Rows="1">
<StackPanel>
<Label Content="3W1L" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o1" IsChecked="{Binding o1}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="1" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="3W3V" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o2" IsChecked="{Binding o2}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="2" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="Ni" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o3" IsChecked="{Binding o3}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="3" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="2W1" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o4" IsChecked="{Binding o4}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="4" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="Vac2" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o5" IsChecked="{Binding o5}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="5" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="3W4V" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o6" IsChecked="{Binding o6}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="6" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="Cu" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o7" IsChecked="{Binding o7}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="7" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
<StackPanel>
<Label Content="3W2L" HorizontalAlignment="Center" VerticalAlignment="Center" />
<CheckBox Name="DO1o8" IsChecked="{Binding o8}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Label Content="8" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
</UniformGrid>
</GroupBox>
I've read about control compositing, grouping a bunch of controls into a single control. I'd like to make this whole GroupBox a single control I can add or remove procedurally. How can I accomplish this with IronPython?