[This is preliminary documentation and is subject to change.]

Gets or sets the value determining if when no rows are found, the UIController will switch to insert activity automatically.

Namespace:  Firefly.Box
Assembly:  Firefly.Box (in Firefly.Box.dll) Version: (


public bool SwitchToInsertWhenNoRows { get; set; }
Visual Basic (Declaration)
Public Property SwitchToInsertWhenNoRows As Boolean
Visual C++
property bool SwitchToInsertWhenNoRows {
	bool get ();
	void set (bool value);


If this property is set to true, and the AllowInsert property is set to false, the UIController will exit, when no rows are found.


Deferent Activities
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
This example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of Form
using Firefly.Box;
using Firefly.Box.UI;

namespace TestFirefly.Box.Documentation
    public class DemoSwitchActivities
        public void Run()
            var jobs = new Pubs.Jobs();

            var uic = new UIController
                From = jobs,
                AllowBrowse = true,//the default
                AllowDelete = true,//the default
                AllowInsert = true,//the default
                AllowUpdate = true,//the default

                View = UITools.GenerateFormWithGridFor("Jobs and activities",
                                                       "Press the buttons below to switch between the deferent activities, notice that the title displays the current activity",
            //Set the form title according to the activity
            uic.ActivityChanged += () => uic.View.Text = "The Activity is " + uic.Activity.ToString();

            var switchToInsert = new Button
                Text = "Switch To Insert",
                Width = 100
            switchToInsert.Click += (a, b) => uic.Raise(Command.SwitchToInsertActivity);

            var switchToBrowse = new Button
                Text = "Switch To Browse",
                Width = 100
            switchToBrowse.Click += (a, b) => uic.Raise(Command.SwitchToBrowseActivity);

            var switchToUpdate = new Button
                Text = "Switch To Update",
                Width = 100
            switchToUpdate.Click += (a, b) => uic.Raise(Command.SwitchToUpdateActivity);

            var insertRow = new Button { Text = "Insert Row" };
            insertRow.Click += (a, b) => uic.Raise(Command.InsertRow);

            var deleteRow = new Button { Text = "Delete Row" };
            deleteRow.Click += (a, b) => uic.Raise(Command.DeleteRow);

            UITools.AddControlsToForm(uic.View, switchToInsert, switchToBrowse, switchToUpdate, insertRow, deleteRow);


See Also