public override void Run(Window window) { var surface = new CircleSurface(); var list = new CircleGenList(window, surface) { Homogeneous = true, VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, }; list.Show(); ((IRotaryActionWidget)list).Activate(); list.Move(0, 0); list.Resize(360, 360); GenItemClass defaultClass = new GenItemClass("default") { GetTextHandler = (obj, part) => { return(string.Format("{0} - {1}", (string)obj, part)); } }; for (int i = 0; i < 100; i++) { list.Append(defaultClass, string.Format("{0} Item", i)); } list.ItemSelected += List_ItemSelected;; }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); var surface = new CircleSurface(conformant); var list = new CircleGenList(conformant, surface) { Homogeneous = true, VerticalScrollBarColor = Color.Red, VerticalScrollBackgroundColor = Color.Pink, VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Visible, }; ((IRotaryActionWidget)list).Activate(); conformant.SetContent(list); GenItemClass defaultClass = new GenItemClass("default") { GetTextHandler = (obj, part) => { return(string.Format("{0} - {1}", (string)obj, part)); } }; for (int i = 0; i < 100; i++) { list.Append(defaultClass, string.Format("{0} Item", i)); } list.ItemSelected += List_ItemSelected;; }
public override void Run(Window window) { var layout = new Layout(window); layout.Show(); layout.Move(0, 0); layout.Resize(360, 360); var surface = new CircleSurface(layout); var list = new CircleGenList(layout, surface) { Homogeneous = true, VerticalScrollBackgroundRadius = 165, VerticalScrollBarRadius = 165, VerticalScrollBackgroundLineWidth = 30, VerticalScrollBarLineWidth = 30, }; list.Show(); ((IRotaryActionWidget)list).Activate(); list.Move(0, 0); list.Resize(360, 360); list.Lower(); GenItemClass defaultClass = new GenItemClass("default") { GetTextHandler = (obj, part) => { return(string.Format("{0} - {1}", (string)obj, part)); } }; for (int i = 0; i < 100; i++) { list.Append(defaultClass, string.Format("{0} Item", i)); } list.ItemSelected += List_ItemSelected;; }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); var naviframe = new Naviframe(conformant); conformant.SetContent(naviframe); var surface = new CircleSurface(conformant); var list = new CircleGenList(naviframe, surface) { Homogeneous = true, VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, IsEnabled = false, }; ((IRotaryActionWidget)list).Activate(); var item = naviframe.Push(list); item.Style = "empty"; GenItemClass defaultClass = new GenItemClass("default") { GetTextHandler = (obj, part) => { return(string.Format("{0} - {1}", (string)obj, part)); } }; for (int i = 0; i < 100; i++) { list.Append(defaultClass, string.Format("{0} Item", i)); } list.ItemSelected += List_ItemSelected;; }
void InitializeComponent() { _outterBox.SetLayoutCallback(OnLayout); _surfaceLayout = new ELayout(this); _surfaceLayout.Show(); _surface = new CircleSurface(_surfaceLayout); _naviMenu = new CircleGenList(this, _surface) { Homogeneous = true, BackgroundColor = ElmSharp.Color.Gray }; _naviMenu.Show(); _draggedUpCallback = new SmartEvent(_naviMenu, "drag,start,up"); _draggedUpCallback.On += (s, e) => { if (_footer.TrackObject.IsVisible) { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.EdgeBottom)); } else { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.Up)); } }; _draggedDownCallback = new SmartEvent(_naviMenu, "drag,start,down"); _draggedDownCallback.On += (s, e) => { if (_header.TrackObject.IsVisible) { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.EdgeTop)); } else { Dragged?.Invoke(this, new DraggedEventArgs(DraggedState.Down)); } }; _outterBox.PackEnd(_naviMenu); _outterBox.PackEnd(_surfaceLayout); _surfaceLayout.StackAbove(_naviMenu); _defaultClass = new GenItemClass("1icon_1text") { GetTextHandler = (obj, part) => { if (part == "elm.text") { return((obj as Item).Text); } return(null); }, GetContentHandler = (obj, part) => { if (part == "elm.swallow.icon" && obj is Item menuItem && !string.IsNullOrEmpty(menuItem.Icon)) { var icon = new ElmSharp.Image(Xamarin.Forms.Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1.0, WeightY = 1.0, MinimumWidth = _dafaultIconSize, MinimumHeight = _dafaultIconSize, }; icon.Show(); icon.Load(menuItem.Icon); return(icon); } return(null); } }; _naviMenu.ItemSelected += OnItemSelected; } void OnItemSelected(object sender, GenListItemEventArgs e) { ItemSelected?.Invoke(this, new SelectedItemChangedEventArgs((e.Item.Data as Item).Source, -1)); } void OnLayout() { _surfaceLayout.Geometry = Geometry; _naviMenu.Geometry = Geometry; } bool IsUpdated(List <List <Element> > items) { if (_itemCache == null) { return(true); } if (_itemCache.Count != items.Count) { return(true); } for (int i = 0; i < items.Count; i++) { if (_itemCache[i].Count != items[i].Count) { return(true); } for (int j = 0; j < items[i].Count; j++) { if (_itemCache[i][j] != items[i][j]) { return(true); } } } return(false); } }