Customize C# SDK UI

You can also override the existing Paddle UI with your own custom-built windows. To do this you need to add an implementation of the appropriate interface (IProductInfoWindow, ILicenseWindow, or ILicenseRecoveryWindow) to your window, and pass it into one of the corresponding OverrideWindow methods.

For example, if you wanted to replace the Product Info dialog with a custom WPF window, you would write your XAML code as usual:


<Window x:Class="PopupDemo.MyProductInfoWindow">
    ...
		<StackPanel Orientation="Vertical">
			<Button  Click="ActivateClick">Activate</Button>
			<Button Click="BuyClick">Buy</Button>
		</StackPanel>
    ...
</Window>

Then implement the IProductInfoWindow in the code-behind file:


public partial class MyProductInfoWindow : Window, IProductInfoWindow
{
    public ProductWindowTest()
    {
        InitializeComponent();
    }

    public PaddleProduct Product { get; set; }

    private void BuyClick(object sender, RoutedEventArgs e)
    {
        Paddle.Instance.ShowCheckoutWindowForProduct(Product);
    }

    private void ActivateClick(object sender, RoutedEventArgs e)
    {
        Paddle.Instance.ShowLicenseActivationWindowForProduct(Product);
    }
    
    void IProductInfoWindow.Show()
    {
        this.Show();
    }

    void IProductInfoWindow.ShowDialog()
    {
        this.ShowDialog();
    }
}

Finally, you tell the SDK to use your window. This needs to be done after the SKD has been initialised:


public void StartPaddle()
{
    // Initialise the SDK.
	var productInfo = new PaddleProductConfig { ProductName = "App Name", VendorName = "My Company" };
    Paddle.Configure(ApiKey, VendorId, ProductId, productInfo);
  
    // Override the default ProductInfo window with your custom implementation.
    Paddle.Instance.OverrideProductInfoWindow();

	PaddleProduct product = PaddleProduct.CreateProduct(ProductId);

    // Show your custom Product window
    Paddle.Instance.ShowProductAccessWindowForProduct(product);
}
</code></pre>


</div>

Questions about Paddle?

If you need any help regarding your Paddle integration, please get in touch with our Customer Success team using the form below.