Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

Help about create a list of custom control inside a panel

$
0
0

I have an old Xamarin.Mac project migrated to Unified, without any storyboard.

In a window, i need an scroll area where i can instantiate at runtime a list of custom control.

With Mono/WinForms, i create a class derived from UserControl, in the Window i place a Panel with AutoScroll=true
and i populate for example with

for(int i=0;i<10;i++)
{
    UserControl ctrl = new MyUserControl;
        ctrl.Top = i * ctrl.Height;
        myPanel.Controls.Add(ctrl);
}

What is the corresponding method with Xamarin.Mac?

I create a View.cs derived from NSView, View.xib, ViewController.cs derived from NSViewController.
In the Window, i place a NSScrollView.
And now? The only constructor of View expect a "IntPtr handle".

Any feedback is appreciated, thx.


Viewing all articles
Browse latest Browse all 1429

Trending Articles