/* * This file provides a place where methods can be put to Expose Internals, so that other libraries can extend the Formw ith new controls * + Prefix the function names with _Extend_ to ensure that they are used as intended */ // this is the public version of AddRowToHost public void _Extend_AddRowToHost(Control ctrl, AddRowToHostFunctions functions = null, bool rowAutoHeight = true) { AddRowToHost(ctrl: ctrl, functions: functions, ctrlIndex: null, rowAutoHeight: rowAutoHeight); }
private void AddRowToHost(Control ctrl, AddRowToHostFunctions functions = null, string ctrlIndex = null, bool rowAutoHeight = true) { handleAddingControlToIndexIfRequested(ctrl, ctrlIndex); AddHostChild(ctrl, rowAutoHeight); SetupAddRowToHostFunctionsIfAny(ctrl, functions); }
private void SetupAddRowToHostFunctionsIfAny(Avalonia.Controls.Control row, AddRowToHostFunctions functions = null) { if (functions != null) { functions.show = () => { row.IsVisible = true; }; functions.hide = () => { row.IsVisible = false; }; } }
private void AddRowToHost(Control ctrl, string rowLabel, AddRowToHostFunctions functions = null, string ctrlIndex = null, bool rowAutoHeight = true) { DockPanel row = new DockPanel(); TextBlock label = new TextBlock(); handleAddingControlToIndexIfRequested(ctrl, ctrlIndex); label.Text = rowLabel; row.Children.Add(label); row.Children.Add(ctrl); DockPanel.SetDock(label, Dock.Left); DockPanel.SetDock(ctrl, Dock.Right); AddHostChild(row, rowAutoHeight); SetupAddRowToHostFunctionsIfAny(row, functions); }