Пример #1
0
        public NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            if (IsViewReady)
            {
                Employee emp = DataStore.Employees[(int)row];
                switch (tableColumn.Identifier)
                {
                case "FirstName":
                    return(new NSString(emp.FirstName));

                case "LastName":
                    return(new NSString(emp.LastName));

                case "DepartmentName":
                    NSPopUpButtonCell button = tableColumn.DataCellForRow(row) as NSPopUpButtonCell;
                    button.RemoveAllItems();
                    foreach (Department dep in DataStore.Departments)
                    {
                        button.Menu.AddItem(dep.Name, new ObjCRuntime.Selector("departmentSelected:"), "");
                    }
                    return(button);

                default:
                    return(new NSString(""));
                }
            }
            else
            {
                return(new NSString(""));
            }
        }
Пример #2
0
        public void WillDisplayCell(NSTableView tableView, NSObject cell, NSTableColumn tableColumn, nint row)
        {
            Employee emp = DataStore.Employees[(int)row];

            if (tableColumn.Identifier == "DepartmentName")
            {
                NSPopUpButtonCell button = cell as NSPopUpButtonCell;
                button.SetTitle(emp.DepartmentName);
            }
        }
        partial void ScaleChosen(NSPopUpButtonCell sender)
        {
            //use the selected index from the actual object
            //instead of the sender, there's something wrong
            //where the sender is providing indexes in the thousands.
            var selectedIndex = ScaleChooser.IndexOfSelectedItem - 1;

            ChosenScale = Enum.GetValues(typeof(Scale))
                          .Cast <Scale>()
                          .ToArray()
                          [selectedIndex];
        }
Пример #4
0
        private GlobsTableView(IntPtr instance)
            : base(instance)
        {
            // Get the menu used by the popup button cells.
            m_popup = this["col2"].Call("dataCell").To<NSPopUpButtonCell>();
            m_popup.retain();

            // Initialize the menu.
            DoPopulateMenu();

            // Hookup the table.
            setDataSource(this);

            setTarget(this);
            setAction("clicked:");

            Broadcaster.Register("languages changed", this);
            ActiveObjects.Add(this);
        }