public ExpanderSection() { var expandedCheckBox = new CheckBox { Text = "Expanded" }; var expander = new Expander { Header = "Test Header", Content = new Panel { Size = new Size(200, 200), BackgroundColor = Colors.Blue } }; expandedCheckBox.CheckedBinding.Bind(expander, e => e.Expanded); LogEvents(expander); var expander2 = new Expander { Header = new StackLayout { Orientation = Orientation.Horizontal, Items = { "Test Expanded with custom header", new TextBox() } }, Expanded = true, Content = new Panel { Size = new Size(300, 200), BackgroundColor = Colors.Blue } }; LogEvents(expander2); Content = new StackLayout { Padding = new Padding(10), Items = { expandedCheckBox, expander, expander2 } }; }
void LogEvents(Expander button) { button.ExpandedChanged += (sender, e) => Log.Write(button, "ExpandedChanged: {0}", button.Expanded); }
/// <summary> /// Raises the expanded changed event. /// </summary> /// <param name="widget">Widget to raise the event.</param> /// <param name="e">Event arguments.</param> public void OnExpandedChanged(Expander widget, EventArgs e) { widget.Platform.Invoke(() => widget.OnExpandedChanged(e)); }
/// <summary> /// Raises the expanded changed event. /// </summary> /// <param name="widget">Widget to raise the event.</param> /// <param name="e">Event arguments.</param> public void OnExpandedChanged(Expander widget, EventArgs e) { using (widget.Platform.Context) widget.OnExpandedChanged(e); }