• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NSTableColumn类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NSTableColumn的典型用法代码示例。如果您正苦于以下问题:C# NSTableColumn类的具体用法?C# NSTableColumn怎么用?C# NSTableColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NSTableColumn类属于命名空间,在下文中一共展示了NSTableColumn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetViewForItem

        public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            int r = (int)row;

            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view
            // If a non-null view is returned, you modify it enough to reflect the new data
            NSTextField view = (NSTextField)tableView.MakeView (CellIdentifier, this);
            if (view == null) {
                view = new NSTextField ();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }
                
            // Setup view based on the column selected
            switch (tableColumn.Identifier) {
                case CellIdentifierFirst:
                    view.StringValue = DataSource.Items[r];
                    break;
            }

            return view;
        }  
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:26,代码来源:StringListTableDelegate.cs


示例2: GetCell

        public override NSCell GetCell(NSOutlineView view, NSTableColumn column, MonoMac.Foundation.NSObject item)
        {
            NSCmisTree cmis = item as NSCmisTree;
            if (cmis == null) {
                Console.WriteLine ("GetCell Error");
                return null;
            }
            if (column == null) {
                return null;
            } else if (column.Identifier.Equals ("Name")) {
//                Console.WriteLine ("GetCell " + cmis);
                NSButtonCell cell = new NSButtonCell ();
                if (cmis.Parent != null)
                    cell.SetButtonType (NSButtonType.Switch);
                else
                    cell.SetButtonType (NSButtonType.Radio);
                // FIXME cell.AllowsMixedState = true;
                cell.Title = cmis.Name;
                cell.Editable = true;
                return cell;
            } else {
                NSTextFieldCell cell = new NSTextFieldCell ();
                return cell;
            }
        }
开发者ID:pcreignou,项目名称:CmisSync,代码行数:25,代码来源:OutlineViewDelegate.cs


示例3: GetViewForItem

		public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, int row)
		{
			var view = (NSTableCellView)tableView.MakeView (tableColumn.Identifier, this);

			string value = string.Empty;
			switch (tableColumn.HeaderCell.Title) {

			case "Added":
				value = _notes [row].Added.ToShortDateString();
				break;

			case "Author":
				value = _notes [row].Author;
				break;

			case "Note":
				value = _notes [row].Content;
				break;

			default:
				break;
			}

			view.TextField.StringValue = value;
			return view;
		}
开发者ID:rexebin,项目名称:UnicornStore,代码行数:26,代码来源:NoteViewSource.cs


示例4: GetObjectValue

        public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row)
        {
            NSTableColumn[] cols = tableView.TableColumns();
            int idx = cols.ToList().FindIndex(t => t.HeaderCell.StringValue == tableColumn.HeaderCell.StringValue);

            switch(idx)
            {
                case (int)TableLocation.AV:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.TV:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.ISO:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.Keyframe:
                    return NSObject.FromObject(((bool)(Rows[row][idx])) ? NSCellStateValue.On : NSCellStateValue.Off);
                case (int)TableLocation.Filename:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.Nr:
                    return new NSString(Rows[row][idx].ToString());
                case (int)TableLocation.Brightness:
                    return new NSString(Rows[row][idx].ToString());

                default:
                    return new NSString("N/A");
            }
        }
开发者ID:ivynetca,项目名称:lapsestudio,代码行数:26,代码来源:HelperClasses.cs


示例5: GetViewForItem

        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            int r = (int)row;
            if (tableColumn.Identifier == CellIdentifierEnabled)
            {
                NSButton v = null;
                if (v == null)
                {
                    v = new NSButton();
                    v.Title = string.Empty;
                    v.SetButtonType(NSButtonType.Switch);
                    if (_dataSource.Items[r].Checked)
                    {
                        v.State = NSCellStateValue.On;
                    }
                    else
                    {
                        v.State = NSCellStateValue.Off;
                    }
                    v.Activated += (object sender, EventArgs e) =>
                    {
                        var b = v.State == NSCellStateValue.On;
                        _dataSource.Items[r].Checked = b;
                        _controller.SaveRuleState(r, b);
                    };
                }
                return v;
            }


            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view
            // If a non-null view is returned, you modify it enough to reflect the new data
            NSTextField view = (NSTextField)tableView.MakeView(CellIdentifier, this);
            if (view == null)
            {
                view = new NSTextField();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }

            // Setup view based on the column selected
            switch (tableColumn.Identifier)
            {
                case CellIdentifierEnabled:
                    view.StringValue = _dataSource.Items[r].Checked.ToString();
                    break;
                case CellIdentifierFixWhat:
                    view.StringValue = _dataSource.Items[r].Name;
                    break;
                case CellIdentifierExample:
                    view.StringValue = _dataSource.Items[r].Example;
                    break;
            }

            return view;
        }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:60,代码来源:FixCommonErrorsTableDelegate.cs


示例6: SetObjectValue

			public override void SetObjectValue (NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, int row)
			{
				NSString newNSValue = theObject as NSString;
				if (newNSValue == null)
					return;
				string newValue = newNSValue.ToString ();
				int columnIndex = tableView.FindColumn ((NSString)tableColumn.Identifier);
				BookmarkManager.Entry entry = entries[row];
				switch (columnIndex) {
				case 0:
					if (!string.IsNullOrWhiteSpace (newValue))
						entry.Name = newValue;
					break;
				case 1:
					entry.Notes = newValue;
					break;
				case 2:
					if (!string.IsNullOrWhiteSpace (newValue))
						entry.Url = newValue;
					break;
				default:
					break;
				}
				manager.CommitBookmarkChange (entry);
			}
开发者ID:roblillack,项目名称:monomac,代码行数:25,代码来源:BookmarkAssistantController.cs


示例7: ObjectValueForTableColumn

		public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row)
		{
			var value = (NSString)string.Empty;
			ActionHelper.Execute (delegate() {
				if (Entries != null) {
					var obj = (this.Entries [row]) as UserDto;

					switch (col.Identifier) {
					case "Name":
						value = (NSString)obj.Name;
						break;
					case "FirstName":
						value = (NSString)obj.PersonDetails.FirstName;
						break;
					case "LastName": 
						value = (NSString)obj.PersonDetails.LastName;
						break;
					case "Email": 
						value = (NSString)obj.PersonDetails.EmailAddress;
						break;
					case "Description":
						value = (NSString)obj.PersonDetails.Description;
						break;
					default:
						break;
					}
				}
			});
			return value;
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:30,代码来源:UsersDataSource.cs


示例8: ToNSTableColumns

		public static List<NSTableColumn> ToNSTableColumns (List<ColumnOptions> options)
		{
			var columns = new List<NSTableColumn> ();
			//var bgColor = NSColor.FromDeviceRgba ((float)(229.0 / 255), (float)(229.0 / 255), (float)(255.0 / 255), (float)1.0);
			foreach (var option in options.OrderBy(x=>x.DisplayOrder)) {
				var width = option.Width == 0 ? 200 : option.Width;
				var col = new NSTableColumn (option.Id) {
					
					HeaderCell = new NSTableHeaderCell { 
						Title = option.DisplayName,
						Alignment = NSTextAlignment.Left,
						//BackgroundColor = bgColor,
						//TextColor = NSColor.Blue,
						//DrawsBackground = true,
						//Bordered = true
					},
					MinWidth = width,
					Width = width,
					ResizingMask = NSTableColumnResizing.UserResizingMask
				};
				if (option.Type == ColumnType.Browser)
					col.DataCell = new NSBrowserCell ();
				else
					col.DataCell = new NSTextFieldCell ();

				col.HeaderToolTip = "Displays " + option.DisplayName;
				columns.Add (col);
			}	
			return columns;
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:30,代码来源:ListViewHelper.cs


示例9: GetObjectValue

        public override NSObject GetObjectValue(NSTableView tableView, 
		                                         NSTableColumn tableColumn, 
		                                         int row)
        {
            AreaInfo a = Items[row];

            if (tableColumn.Identifier == "List") {
                if(a.UserList == AreaInfo.UserListType.WhiteList)
                    return NSImage.ImageNamed("blacklist_0.png");
                else if(a.UserList == AreaInfo.UserListType.BlackList)
                    return NSImage.ImageNamed("blacklist_1.png");
                else
                    return NSImage.ImageNamed("blacklist_2.png");
            } else if (tableColumn.Identifier == "Flag") {
                return NSImage.ImageNamed("flag_" + a.Code.ToLowerInvariant() + ".png");
            } else if (tableColumn.Identifier == "Name") {
                return new NSString (a.Name);
            } else if (tableColumn.Identifier == "Servers") {
                return new NSString (a.Servers.ToString());
            } else if (tableColumn.Identifier == "LoadIcon") {
                return NSImage.ImageNamed("status_" + a.GetLoadColorForList().ToLowerInvariant() + ".png");
            } else if (tableColumn.Identifier == "Load") {
                return new NSString (a.GetLoadForList());
            } else if (tableColumn.Identifier == "Users") {
                return new NSString (a.Users.ToString());
            } else
                throw new NotImplementedException (string.Format ("{0} is not recognized", tableColumn.Identifier));
        }
开发者ID:Clodo76,项目名称:airvpn-client,代码行数:28,代码来源:TableAreasController.cs


示例10: GetObjectValue

		public override NSObject GetObjectValue (NSTableView tableView, 
		                                         NSTableColumn tableColumn, 
		                                         int row)
		{
			TableAdvancedEventsControllerItem i = Items [row];

			if (tableColumn.Identifier == "Event") {
				return new NSString (i.Title);
			}
			else if (tableColumn.Identifier == "FileName") {
				return new NSString (i.Filename);
			}
			else if (tableColumn.Identifier == "Arguments") {
				return new NSString (i.Arguments);
			}
			else if (tableColumn.Identifier == "WaitEnd") {
				if ((i.Filename.Trim () != "") || (i.Arguments.Trim () != "")) {
					if (i.WaitEnd)
						return NSImage.ImageNamed ("status_green_16.png");
					else
						return NSImage.ImageNamed ("status_red_16.png");
				} else
					return NSImage.ImageNamed ("status_unknown.png");
			}

			else 
				throw new NotImplementedException (string.Format ("{0} is not recognized", tableColumn.Identifier));
		}
开发者ID:liftir,项目名称:airvpn-client,代码行数:28,代码来源:TableAdvancedEventsController.cs


示例11: GetViewForItem

        public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            int r = (int)row;
            if (tableColumn.Identifier == CellIdentifierApply)
            {
                //var v = (NSButton)tableView.MakeView (CellIdentifier, this);
                NSButton v = null;
                if (v == null)
                {
                    v = new NSButton();
                    v.Title = string.Empty;
                    v.SetButtonType(NSButtonType.Switch);
                    if (_dataSource.Items[r].Apply)
                    {
                        v.State = NSCellStateValue.On;
                    }
                    else
                    {
                        v.State = NSCellStateValue.Off;
                    }
                    v.Activated += (object sender, EventArgs e) =>
                    {
                        _dataSource.Items[r].Apply = v.State == NSCellStateValue.On;
                    };
                }
                return v;
            }


            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view
            // If a non-null view is returned, you modify it enough to reflect the new data
            NSTextField view = (NSTextField)tableView.MakeView (CellIdentifier, this);
            if (view == null) {
                view = new NSTextField ();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }

            // Setup view based on the column selected
            switch (tableColumn.Identifier) {
                case CellIdentifierApply:
                    view.StringValue = _dataSource.Items[r].Apply.ToString();
                    break;
                case CellIdentifierLineNumber:
                    view.StringValue = _dataSource.Items[r].LineNumber;
                    break;
                case CellIdentifierBefore:
                    view.StringValue = _dataSource.Items[r].Before.ToListViewString();
                    break;
                case CellIdentifierAfter:
                    view.StringValue = _dataSource.Items[r].After.ToListViewString();
                    break;
            }

            return view;
        }  
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:60,代码来源:PreviewTableDelegate.cs


示例12: GetViewForItem

		public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, int row)
		{
			var product = WebService.Shared.CurrentOrder.Products [row];
			ShoppingBasketTableViewCellController controller = new ShoppingBasketTableViewCellController ();
			controller.Product = product;
			return (ShoppingBasketTableViewCell)controller.View;
		}
开发者ID:robertmiles3,项目名称:xamarin-store-app,代码行数:7,代码来源:ShoppingBasketTableViewSource.cs


示例13: GetObjectValue

        public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row)
        {
            //			var valueKey = (string)(NSString)tableColumn.Identifier;
            //			var dataRow = _profiles[row];

            return null;
        }
开发者ID:joemcbride,项目名称:outlander,代码行数:7,代码来源:ProfileSelectorController.cs


示例14: GetViewForItem

        public NSView GetViewForItem(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var libraryBrowserItem = (LibraryBrowserItem)item;
            var view = (NSTableCellView)outlineView.MakeView("cellLibrary", this);
            view.TextField.Font = NSFont.FromFontName("Roboto", 11);
            view.TextField.StringValue = libraryBrowserItem.Entity.Title;

            switch (libraryBrowserItem.Entity.EntityType)
            {
                case LibraryBrowserEntityType.AllSongs:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_artists");
                    break;
                case LibraryBrowserEntityType.Artists:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_artists");
                    break;
                case LibraryBrowserEntityType.Album:
                case LibraryBrowserEntityType.Albums:
                case LibraryBrowserEntityType.ArtistAlbum:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_vinyl");
                    break;
                case LibraryBrowserEntityType.Artist:
                    view.ImageView.Image = ImageResources.Images.FirstOrDefault(x => x.Name == "icon_user");
                    break;
            } 

            return view;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:27,代码来源:LibraryBrowserOutlineViewDelegate.cs


示例15: ObjectValueForTableColumn

 public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row)
 {
     try {
         if (Entries != null) {
             X509Certificate2 cert = Entries [row].Cert;
             switch (col.Identifier) {
             case "Alias":
                 return (NSString)Entries [row].Alias;
             case VMIdentityConstants.CERT_ISSUED_BY:
                 return (NSString)cert.Issuer;
             case VMIdentityConstants.CERT_ISSUED_DATE:
                 return (NSString)cert.NotBefore.ToShortDateString ();
             case VMIdentityConstants.CERT_EXPIRATION_DATE:
                 return (NSString)cert.NotAfter.ToShortDateString ();
             case VMIdentityConstants.CERT_INTENDED_PURPOSES:
                 return (NSString)cert.GetKeyUsage ();
             case VMIdentityConstants.CERT_STATUS:
                 break;
             case VMIdentityConstants.CERT_ISSUED_TO:
                 return (NSString)cert.Subject;
             }
         }
     } catch (Exception e) {
         System.Diagnostics.Debug.WriteLine ("Error in fetching data : " + e.Message);
     }
     return null;
 }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:27,代码来源:CertificateDetailsListView.cs


示例16: GetObjectValue

        public override NSObject GetObjectValue(NSTableView table, NSTableColumn col, int row)
        {
            int column;

            // Determine which column is being selected
            switch (col.HeaderCell.Title) {
            case "Count":
                column = 0;
                break;
            case "Number":
                column = 1;
                break;
            case "Distance":
                column = 2;
                break;
            case "Interval":
                column = 3;
                break;
            case "Stroke":
                column = 4;
                break;
            case "Comment":
                column = 5;
                break;
            default:
                break;
            }
            if (row + 1 > m_tableData [column].Count)
                return new NSString ("");
            else
                return new NSString (m_tableData [column] [row]);
        }
开发者ID:photo-bro,项目名称:AquaTempus,代码行数:32,代码来源:TableViewHandler.cs


示例17: SetupOutlineView

		// This sets up a NSOutlineView for demonstration
		internal static NSView SetupOutlineView (CGRect frame)
		{
			// Create our NSOutlineView and set it's frame to a reasonable size. It will be autosized via the NSClipView
			NSOutlineView outlineView = new NSOutlineView () {
				Frame = frame
			};

			// Every NSOutlineView must have at least one column or your Delegate will not be called.
			NSTableColumn column = new NSTableColumn ("Values");
			outlineView.AddColumn (column);
			// You must set OutlineTableColumn or the arrows showing children/expansion will not be drawn
			outlineView.OutlineTableColumn = column;

			// Setup the Delegate/DataSource instances to be interrogated for data and view information
			// In Unified, these take an interface instead of a base class and you can combine these into
			// one instance. 
			outlineView.Delegate = new OutlineViewDelegate ();
			outlineView.DataSource = new OutlineViewDataSource ();

			// NSOutlineView expects to be hosted inside an NSClipView and won't draw correctly otherwise  
			NSClipView clipView = new NSClipView (frame) {
				AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable
			};
			clipView.DocumentView = outlineView;
			return clipView;
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:27,代码来源:NSOutlineViewExample.cs


示例18: GetObjectValue

        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("");
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:26,代码来源:EmployeeViewController.cs


示例19: GetObjectValue

        public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, int row)
        {
            if (row != -1)
                return (NSString)Program.Instance.StreamDeskCoreInstance.SettingsInstance.ActiveDatabases[row];

            return null;
        }
开发者ID:nagyist,项目名称:StreamDesk,代码行数:7,代码来源:ManageDatabasesController.cs


示例20: ObjectValueForTableColumn

		public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row)
		{
			var value = (NSString)string.Empty;
			ActionHelper.Execute (delegate() {
				if (Entries != null) {
					var obj = (this.Entries [row]) as AssertionConsumerServiceDto;

					switch (col.Identifier) {
					case "Name":
						value = (NSString)obj.Name;
						break;
					case "Index":
						value = (NSString)obj.Index.ToString ();
						break;
					case "Binding":
						value = (NSString)obj.Binding;
						break;
					case "Endpoint":
						value = (NSString)obj.Endpoint;
						break;
					case "IsDefault":
						value = (NSString)obj.IsDefault.ToString ();
						break;
					default:
						break;
					}
				}
			});
			return value;
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:30,代码来源:AssertionConsumerServiceDataSource.cs



注:本文中的NSTableColumn类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NSTableView类代码示例发布时间:2022-05-24
下一篇:
C# NSString类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap