Common UI code in a base class?
<p>I have a scenario where I need to put some common code into a base class (proposed solution).</p>

<p>Say I have the below code inside a UserControl class file BookingsCreatePage.cs</p>

<pre><code>public partial class BookingsCreatePage : UserControl, IPrototypeUX
{
    public BookingsCreatePage()
    {
        InitializeComponent();
        SetupPadding();
    }

    //Implementing my own Interface IPrototypeUX here
    void SetupPadding()
    {
        tlpBase.Margin = new Padding(0);

        panelHeading.Margin = new Padding(0);
        tlpBookingDetails.Margin = new Padding(7, 0, 7, 0);
        panelNav.Margin = new Padding(10, 0, 10, 0);
        panelWarning.Margin = new Padding(0);
    }
}
</code></pre>

<p>Now I want to put <code>panelNav.Margin = new Padding(10, 0, 10, 0);</code> line into a common area, possibly a base class or something which I cannot think right now. </p>

<p>I'm having same named panel in each of my UserControls. So either I need to pass this <code>panelNav</code> variable to the base class as a parameter or somehow hardcode it there. </p>

<p>What would be the best way to do this common coding structure?</p>