示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.Native.Canvas"/> class.
        /// </summary>
        /// <remarks>Canvas doesn't support replacing its children, this will be ignored.</remarks>
        /// <param name="parent">Parent of this instance.</param>
        public LayoutCanvas(EvasObject parent) : base(parent)
        {
            SetTheme("layout", "elm_widget", "default");
            _box = new Xamarin.Forms.Platform.Tizen.Native.Box(parent);
            SetContent(_box);

            _children.CollectionChanged += (o, e) =>
            {
                if (e.Action == NotifyCollectionChangedAction.Add)
                {
                    foreach (var v in e.NewItems)
                    {
                        var view = v as EvasObject;
                        if (null != view)
                        {
                            OnAdd(view);
                        }
                    }
                }
                else if (e.Action == NotifyCollectionChangedAction.Remove)
                {
                    foreach (var v in e.OldItems)
                    {
                        if (v is EvasObject view)
                        {
                            OnRemove(view);
                        }
                    }
                }
                else if (e.Action == NotifyCollectionChangedAction.Reset)
                {
                    OnRemoveAll();
                }
            };
        }
示例#2
0
        protected override void OnElementChanged(ElementChangedEventArgs <CircleScrollView> e)
        {
            if (Control == null)
            {
                var surface = this.GetSurface();
                SetNativeControl(new ElmSharp.Wearable.CircleScroller(Xamarin.Forms.Platform.Tizen.Forms.NativeParent, surface));
                InitControl();
                Control.Scrolled            += OnScrolled;
                _scrollCanvas                = new Xamarin.Forms.Platform.Tizen.Native.Box(Control);
                _scrollCanvas.LayoutUpdated += OnContentLayoutUpdated;
                Control.SetContent(_scrollCanvas);
            }
            if (e.OldElement != null)
            {
                (e.OldElement as IScrollViewController).ScrollToRequested -= OnScrollRequestedAsync;
            }
            if (e.NewElement != null)
            {
                (e.NewElement as IScrollViewController).ScrollToRequested += OnScrollRequestedAsync;
            }

            UpdateAll();

            base.OnElementChanged(e);
        }
示例#3
0
 public LayoutCanvas(EvasObject parent)
     : base(parent)
 {
     SetTheme("layout", "elm_widget", "default");
     box = new TBox(parent);
     SetContent(box);
     children.CollectionChanged += OnChildrenCollectionChanged;
     box.LayoutUpdated          += OnBoxLayoutUpdated;
 }
示例#4
0
        public ShellSectionRenderer(ShellSection section)
        {
            _section = section;
            _section.PropertyChanged += OnSectionPropertyChanged;
            (_section.Items as INotifyCollectionChanged).CollectionChanged += OnShellSectionCollectionChanged;

            _box = new Native.Box(Forms.NativeParent);
            _box.LayoutUpdated += OnLayoutUpdated;

            CreateToolbar();
            UpdateCurrentShellContent(_section.CurrentItem);

            ((IShellController)_section.Parent.Parent).AddAppearanceObserver(this, _section);
        }
示例#5
0
        public ShellSectionRenderer(ShellSection section)
        {
            _section = section;
            _section.PropertyChanged += OnSectionPropertyChanged;
            (_section.Items as INotifyCollectionChanged).CollectionChanged += OnShellSectionCollectionChanged;

            _box = new Native.Box(Forms.NativeParent);
            _box.LayoutUpdated += OnLayoutUpdated;

            _tabs = CreateToolbar();
            _tabs.TargetView.Show();
            Control.PackEnd(_tabs as EvasObject);
            InitializeTabs();

            ResetToolbarItem();
            UpdateCurrentShellContent(_section.CurrentItem);

            ((IShellController)_section.Parent.Parent).AddAppearanceObserver(this, _section);
        }
示例#6
0
        EvasObject GetContent(object data, string part)
        {
            ShellSection section = data as ShellSection;

            var box = new Native.Box(Forms.NativeParent);

            box.Show();

            var icon = new Native.Image(Forms.NativeParent)
            {
                MinimumWidth  = Forms.ConvertToScaledPixel(44),
                MinimumHeight = Forms.ConvertToScaledPixel(27)
            };
            var task = icon.LoadFromImageSourceAsync(section.Icon);

            icon.Show();

            var title = new Native.Label(Forms.NativeParent)
            {
                Text     = section.Title,
                FontSize = Forms.ConvertToEflFontPoint(14),
                HorizontalTextAlignment = Native.TextAlignment.Start,
                VerticalTextAlignment   = Native.TextAlignment.Center
            };

            title.Show();

            box.PackEnd(icon);
            box.PackEnd(title);
            box.LayoutUpdated += (object sender, LayoutEventArgs e) =>
            {
                icon.Move(e.Geometry.X + _iconPadding, e.Geometry.Y + _iconPadding);
                icon.Resize(_iconSize, _iconSize);

                title.Move(e.Geometry.X + 2 * _iconPadding + _iconSize, e.Geometry.Y);
                title.Resize(e.Geometry.Width - (2 * _iconPadding + _iconSize), e.Geometry.Height);
            };
            box.MinimumHeight = _cellHeight;
            return(box);
        }
示例#7
0
        public ShellItemRenderer(IFlyoutController flyoutController, ShellItem item)
        {
            _flyoutController           = flyoutController;
            _shellItem                  = item;
            _shellItem.PropertyChanged += OnShellItemPropertyChanged;
            (_shellItem.Items as INotifyCollectionChanged).CollectionChanged += OnShellItemsCollectionChanged;

            _box = new Native.Box(Forms.NativeParent);
            _box.LayoutUpdated += OnLayoutUpdated;
            _box.Show();

            CreateToolbar();
            CreateMoreToolbar();
            ResetToolbarItems();

            UpdateCurrentShellSection(_shellItem.CurrentItem);
            if (_drawer != null)
            {
                _currentSection?.StackBelow(_drawer);
            }

            ((IShellController)_shellItem.Parent).AddAppearanceObserver(this, _shellItem);
        }
        public ShellItemRenderer(IFlyoutController flyoutController, ShellItem item)
        {
            _flyoutController           = flyoutController;
            _shellItem                  = item;
            _shellItem.PropertyChanged += OnShellItemPropertyChanged;
            (_shellItem.Items as INotifyCollectionChanged).CollectionChanged += OnShellItemsCollectionChanged;

            _box = new Native.Box(Forms.NativeParent);
            _box.LayoutUpdated += OnLayoutUpdated;
            _box.Show();

            // Create Tabs
            _tabs = CreateTabs();
            _tabs.TargetView.Show();
            Control.PackEnd(_tabs as EvasObject);
            InitializeTabs();

            // Create More Tabs
            _more = CreateMoreToolbar();
            _more.Show();

            _drawer = CreateDrawer();
            _drawer.Show();
            Control.PackEnd(_drawer);
            InitialzeDrawer(_more);

            ResetToolbarItems();

            UpdateCurrentShellSection(_shellItem.CurrentItem);
            if (_drawer != null)
            {
                _currentSection?.StackBelow(_drawer);
            }

            ((IShellController)_shellItem.Parent).AddAppearanceObserver(this, _shellItem);
        }