Skip to content

Instantly share code, notes, and snippets.

@jasondown
Created August 3, 2021 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondown/f095a4fa9a344cfdc89f51f4c325de73 to your computer and use it in GitHub Desktop.
Save jasondown/f095a4fa9a344cfdc89f51f4c325de73 to your computer and use it in GitHub Desktop.
/// <summary>
/// This class wraps a custom multi-image WPF control so that it can be exposed to NAV.
/// </summary>
[ControlAddInExport("Jason.Down.Blog.MultiImageAddinDemo.Controls.MultiImageAddinHostControl")]
public class MultiImageAddinHostControl : WinFormsControlAddInBase
{
private ElementHost _host;
private MultiImageView _view;
private PageableImageControlViewModel _vm;
/// <summary>
/// Creates the Windows Forms Control for the control add-in.
/// </summary>
/// <returns>Returns the Windows Forms control.</returns>
protected override Control CreateControl()
{
_vm = new PageableImageControlViewModel()
{
PageSize = 3
};
_view = new MultiImageView()
{
DataContext = _vm
};
_host = new ElementHost()
{
Dock = DockStyle.Top,
Child = _view,
Size = new Size((int) _view.Width, (int) _view.Height)
};
return _host;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment