Example #1
0
		Control ImagesAndMenu ()
		{
			var control = new TreeGridView {
				Size = new Size (100, 150)
			};

			control.Columns.Add (new GridColumn { DataCell = new ImageTextCell (0, 1), HeaderText = "Image and Text", AutoSize = true, Resizable = true, Editable = true });
			control.Columns.Add (new GridColumn { DataCell = new TextBoxCell (2), HeaderText = "Text", AutoSize = true, Width = 150, Resizable = true, Editable = true });
		
#if DESKTOP
			var menu = new ContextMenu ();
			var item = new ImageMenuItem{ Text = "Click Me!"};
			item.Click += delegate {
				if (control.SelectedItem != null)
					Log.Write (item, "Click, Rows: {0}", control.SelectedItem);
				else
					Log.Write (item, "Click, no item selected");
			};
			menu.MenuItems.Add (item);
			
			control.ContextMenu = menu;
#endif

			control.DataStore = CreateComplexTreeItem (0, "", Image);
			LogEvents (control);
			return control;
		}
        public HiSumDisplay()
        {
            // sets the client (inner) size of the window for your content
            ClientSize = new Eto.Drawing.Size(600, 400);

            Title = "HiSum";
            TreeGridView view = new TreeGridView(){Height = 500};

            view.Columns.Add(new GridColumn() { HeaderText = "Summary", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false });
            var textbox = new TextBox() {Width = 1000};
            var button = new Button(){Text = "Go", Width = 15};
            var label = new Label() {Width = 100};
            var tbResult = new TextArea() {Width = 1000};

            button.Click += (sender, e) =>
            {
                Reader reader = new Reader();
                List<int> top100 = reader.GetTop100();
                List<FullStory> fullStories = new List<FullStory>();
                foreach (int storyID in top100.Take(30))
                {
                    FullStory fullStory = reader.GetStoryFull(storyID);
                    fullStories.Add(fullStory);
                }
                TreeGridItemCollection data = GetTree(fullStories);
                view.DataStore = data;
            };
            Content = new TableLayout
            {
                Spacing = new Size(5, 5), // space between each cell
                Padding = new Padding(10, 10, 10, 10), // space around the table's sides
                Rows = {
                    new TableRow(
                        new Label{Text = "Input URL from Hacker News: ",Width=200},
                        textbox,
                        button,
                        label
                    ),
                    new TableRow(
                        null,
                        tbResult,
                        null,
                        null
                        ),
                    new TableRow(
                        new Label(),
                        view
                    ),

                    // by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form.
                    // otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height.
                    new TableRow { ScaleHeight = true }
                }
            };
        }
Example #3
0
		Control Default ()
		{
			var control = new TreeGridView {
				Size = new Size (100, 150),
				ShowHeader = false
			};
			control.Columns.Add (new GridColumn{ DataCell = new TextBoxCell (0) });
			control.DataStore = CreateSimpleTreeItem (0, "");
			LogEvents (control);
			return control;
		}
Example #4
0
        public DevicesTree()
        {
            _tree = new TreeGridView();

            _tree.AllowMultipleSelection = false;

            _tree.Columns.Add(new GridColumn()
            {
                HeaderText = "Instance",
                DataCell = new TextBoxCell("DeviceInstance")
            });
            _tree.Columns.Add(new GridColumn()
            {
                HeaderText = "Name",
                DataCell = new TextBoxCell("Name"),
                AutoSize = true
            });
            _tree.SelectedItemsChanged += _selectedItemChanged;

            this.Content = _tree;
        }
Example #5
0
		void LogEvents (TreeGridView control)
		{
			control.Activated += (sender, e) => {
				Log.Write (control, "Activated, Item: {0}", e.Item);
			};
			control.SelectionChanged += delegate {
				Log.Write (control, "SelectionChanged, Item: {0}", control.SelectedItem != null ? Convert.ToString (control.SelectedItem) : "<none selected>");
			};

			control.Expanding += (sender, e) => {
				Log.Write (control, "Expanding, Item: {0}", e.Item);
				e.Cancel = !(allowExpanding.Checked ?? true);
			};
			control.Expanded += (sender, e) => {
				Log.Write (control, "Expanded, Item: {0}", e.Item);
			};
			control.Collapsing += (sender, e) => {
				Log.Write (control, "Collapsing, Item: {0}", e.Item);
				e.Cancel = !(allowCollapsing.Checked ?? true);
			};
			control.Collapsed += (sender, e) => {
				Log.Write (control, "Collapsed, Item: {0}", e.Item);
			};
			control.ColumnHeaderClick += delegate(object sender, GridColumnEventArgs e) {
				Log.Write (control, "Column Header Clicked: {0}", e.Column);
			};
		}
Example #6
0
 /// <summary>
 /// Raises the selected item changed event.
 /// </summary>
 public void OnSelectedItemChanged(TreeGridView widget, EventArgs e)
 {
     using (widget.Platform.Context)
         widget.OnSelectedItemChanged(e);
 }
Example #7
0
 /// <summary>
 /// Raises the collapsed event.
 /// </summary>
 public void OnCollapsed(TreeGridView widget, TreeGridViewItemEventArgs e)
 {
     using (widget.Platform.Context)
         widget.OnCollapsed(e);
 }
Example #8
0
 /// <summary>
 /// Raises the expanding event.
 /// </summary>
 public void OnExpanding(TreeGridView widget, TreeGridViewItemCancelEventArgs e)
 {
     using (widget.Platform.Context)
         widget.OnExpanding(e);
 }
Example #9
0
		void LogEvents(TreeGridView control)
		{
			control.Activated += (sender, e) =>
			{
				Log.Write(control, "Activated, Item: {0}", GetDescription(e.Item));
			};
			control.SelectionChanged += delegate
			{
				Log.Write(control, "SelectionChanged, Rows: {0}", string.Join(", ", control.SelectedRows.Select(r => r.ToString())));
			};
			control.SelectedItemChanged += delegate
			{
				Log.Write(control, "SelectedItemChanged, Item: {0}", control.SelectedItem != null ? GetDescription(control.SelectedItem) : "<none selected>");
			};

			control.Expanding += (sender, e) =>
			{
				Log.Write(control, "Expanding, Item: {0}", GetDescription(e.Item));
				e.Cancel = !(allowExpanding.Checked ?? true);
			};
			control.Expanded += (sender, e) =>
			{
				Log.Write(control, "Expanded, Item: {0}", GetDescription(e.Item));
			};
			control.Collapsing += (sender, e) =>
			{
				Log.Write(control, "Collapsing, Item: {0}", GetDescription(e.Item));
				e.Cancel = !(allowCollapsing.Checked ?? true);
			};
			control.Collapsed += (sender, e) =>
			{
				Log.Write(control, "Collapsed, Item: {0}", GetDescription(e.Item));
			};
			control.ColumnHeaderClick += delegate(object sender, GridColumnEventArgs e)
			{
				Log.Write(control, "Column Header Clicked: {0}", e.Column);
			};
		}
Example #10
0
 /// <summary>
 /// Raises the selected item changed event.
 /// </summary>
 public void OnSelectedItemChanged(TreeGridView widget, EventArgs e)
 {
     widget.Platform.Invoke(() => widget.OnSelectedItemChanged(e));
 }
Example #11
0
 /// <summary>
 /// Raises the collapsed event.
 /// </summary>
 public void OnCollapsed(TreeGridView widget, TreeGridViewItemEventArgs e)
 {
     widget.Platform.Invoke(() => widget.OnCollapsed(e));
 }
Example #12
0
 /// <summary>
 /// Raises the collapsing event.
 /// </summary>
 public void OnCollapsing(TreeGridView widget, TreeGridViewItemCancelEventArgs e)
 {
     widget.Platform.Invoke(() => widget.OnCollapsing(e));
 }