示例#1
0
        public TesterView(CGRect bounds) : base()
        {
            Frame = bounds;

            GraphicsPlatform.Register(NativeGraphicsService.Instance);

            tableSource = new TesterTableViewSource();

            tableSource.ScenarioSelected += (drawable) =>
            {
                graphicsView.Drawable = drawable;
                graphicsView.InvalidateDrawable();
            };

            tableView = new UITableView
            {
                AllowsSelection = true,
                Source          = tableSource
            };

            AddSubview(tableView);

            graphicsView = new NativeGraphicsView
            {
                Drawable = ScenarioList.Scenarios[0]
            };

            AddSubview(graphicsView);

            tableView.SelectRow(NSIndexPath.FromRowSection(0, 0), false, UITableViewScrollPosition.None);
        }
示例#2
0
        public TesterView() : base()
        {
            GraphicsPlatform.Register(NativeGraphicsService.Instance);

            tableSource = new TesterTableViewSource();
            tableSource.ScenarioSelected += (drawable) => {
                graphicsView.Drawable = drawable;
                graphicsView.InvalidateDrawable();
            };

            tableView = new NSTableView();
            tableView.AddColumn(new NSTableColumn()
            {
                Width = 300,
            });
            tableView.Source = tableSource;
            //tableView.BackgroundColor = NSColor.White;

            AddSubview(tableView);

            graphicsView = new NativeGraphicsView();
            AddSubview(graphicsView);

            Layout();

            tableView.SelectRow(0, false);
        }
示例#3
0
        public MainView(Context context) : base(context)
        {
            Orientation = Orientation.Horizontal;

            _listView = new ListView(context);
            _listView.LayoutParameters = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.MatchParent,
                2.5f);
            base.AddView(_listView);

            _graphicsView = new NativeGraphicsView(context);
            _graphicsView.BackgroundColor  = Colors.White;
            _graphicsView.LayoutParameters = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.MatchParent,
                1);
            base.AddView(_graphicsView);

            var adapter = new ArrayAdapter(context, Resource.Layout.ListViewItem, ScenarioList.Scenarios);

            _listView.Adapter = adapter;

            _listView.ItemClick += (sender, e) =>
            {
                var scenario = ScenarioList.Scenarios[e.Position];
                _graphicsView.Drawable = scenario;
            };
        }
示例#4
0
 public static void UpdateDrawable(this NativeGraphicsView nativeGraphicsView, IGraphicsView graphicsView)
 {
     nativeGraphicsView.Drawable = graphicsView.Drawable;
 }