本文整理汇总了C#中NSTableView.AddColumn方法的典型用法代码示例。如果您正苦于以下问题:C# NSTableView.AddColumn方法的具体用法?C# NSTableView.AddColumn怎么用?C# NSTableView.AddColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSTableView
的用法示例。
在下文中一共展示了NSTableView.AddColumn方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeTable
private void InitializeTable(NSTableView table)
{
var columns = table.TableColumns();
columns[0].SetIdentifier(PreviewTableDelegate.CellIdentifiers[0]);
columns[0].MinWidth = 50;
columns[0].MaxWidth = 200;
columns[0].Width = 60;
var bc = new NSButtonCell();
bc.SetButtonType(NSButtonType.OnOff);
// columns[0].DataCell = bc;
columns[0].Title = Configuration.Settings.Language.General.Apply;
columns[1].SetIdentifier(PreviewTableDelegate.CellIdentifiers[1]);
columns[1].MinWidth = 50;
columns[1].MaxWidth = 200;
columns[1].Width = 60;
columns[1].Title = Configuration.Settings.Language.General.LineNumber;
table.AddColumn(new NSTableColumn(PreviewTableDelegate.CellIdentifiers[2])
{
MinWidth = 100,
MaxWidth = 2000,
Width = 250,
Title = Configuration.Settings.Language.General.Before,
});
table.AddColumn(new NSTableColumn(PreviewTableDelegate.CellIdentifiers[3])
{
MinWidth = 100,
MaxWidth = 2000,
Width = 250,
Title = Configuration.Settings.Language.General.After,
});
}
示例2: AwakeFromNib
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
this.BtnClose.Activated += (object sender, EventArgs e) => {
this.Close ();
NSApplication.SharedApplication.StopModalWithCode (0);
};
TableView = new NSTableView ();
TableView.Delegate = new TableDelegate ();
TableView.Frame = new CoreGraphics.CGRect (20, 20, 450, 450);
this.MainTableView.AddSubview (TableView);
IList<ComputerDto> computers = new List<ComputerDto> ();
ActionHelper.Execute (delegate() {
var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken (ServerDto.ServerName);
computers = SnapInContext.Instance.ServiceGateway.Server.GetComputers (ServerDto, auth.Token);
});
var listView = new ComputersDataSource { Entries = computers };
var columnNames = new List<ColumnOptions> {
new ColumnOptions{ Id = "Name", DisplayName = "Computer Name", DisplayOrder = 1, Width = 300 },
new ColumnOptions{ Id = "DomainController", DisplayName = "Domain Controller", DisplayOrder = 2, Width = 130 }
};
var columns = ListViewHelper.ToNSTableColumns (columnNames);
foreach (var column in columns) {
TableView.AddColumn (column);
}
TableView.DataSource = listView;
TableView.ReloadData ();
}
示例3: InitializeTable
private void InitializeTable(NSTableView table)
{
var columns = table.TableColumns();
columns[0].SetIdentifier(AutoBackupTableDelegate.CellIdentifiers[0]);
columns[0].MinWidth = 110;
columns[0].MaxWidth = 200;
columns[0].Width = 140;
columns[0].Title = Configuration.Settings.Language.RestoreAutoBackup.DateAndTime;
columns[1].SetIdentifier(AutoBackupTableDelegate.CellIdentifiers[1]);
columns[1].MinWidth = 140;
columns[1].MaxWidth = 10200;
columns[1].Width = 260;
columns[1].Title = Configuration.Settings.Language.RestoreAutoBackup.FileName;
table.AddColumn(new NSTableColumn(AutoBackupTableDelegate.CellIdentifiers[2])
{
MinWidth = 50,
MaxWidth = 200,
Width = 70,
Title = Configuration.Settings.Language.RestoreAutoBackup.Extension,
});
table.AddColumn(new NSTableColumn(AutoBackupTableDelegate.CellIdentifiers[3])
{
MinWidth = 60,
MaxWidth = 150,
Width = 90,
Title = Configuration.Settings.Language.General.Size,
});
//2011-12-13_20-19-18_title
if (Directory.Exists(Configuration.AutoBackupFolder))
{
var autoBackupItems = new List<AutoBackupItem>();
var files = Directory.GetFiles(Configuration.AutoBackupFolder, "*.*");
foreach (string fileName in files)
{
if (fileNamePattern.IsMatch(Path.GetFileName(fileName)))
{
autoBackupItems.Add(new AutoBackupItem(fileName));
}
}
autoBackupItems = autoBackupItems.OrderBy(p => p.DisplayDate).ToList();
var ds = new AutoBackupTableDataSource(autoBackupItems);
table.DataSource = ds;
table.Delegate = new AutoBackupTableDelegate(ds);
}
}
示例4: ToNSTableView
public static NSTableView ToNSTableView(List<ColumnOptions> options, NSTableViewDataSource nodeListView)
{
var view = new NSTableView ();
var columns = ToNSTableColumns (options);
foreach (var column in columns)
view.AddColumn (column);
view.DataSource = nodeListView;
return view;
}
示例5: SetupTableView
// This sets up a NSTableView for demonstration
internal static NSView SetupTableView (CGRect frame)
{
// Create our NSTableView and set it's frame to a reasonable size. It will be autosized via the NSClipView
NSTableView tableView = new NSTableView () {
Frame = frame
};
// Just like NSOutlineView, NSTableView expects at least one column
tableView.AddColumn (new NSTableColumn ("Values"));
tableView.AddColumn (new NSTableColumn ("Data"));
// 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.
tableView.DataSource = new TableDataSource ();
tableView.Delegate = new TableDelegate ();
NSScrollView scrollView = new NSScrollView (frame) {
AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable
};
scrollView.DocumentView = tableView;
return scrollView;
}
示例6: ReloadTableView
public void ReloadTableView(NSTableView tableView, List<HttpTransportViewData> datasource, HttpTransportCollection collection)
{
// tableView.Delegate = new TableDelegate (this);
// var listView = new HttpTransportDataSource { Entries = datasource };
// tableView.DataSource = listView;
// tableView.ReloadData ();
foreach(NSTableColumn column in tableView.TableColumns())
{
tableView.RemoveColumn (column);
}
tableView.Delegate = new TableDelegate (this);
var listView = new HttpTransportDataSource { Entries = datasource, HttpTransportCollection = collection };
var columnNames = new List<ColumnOptions> {
new ColumnOptions{ Id = "Method", DisplayName = "", DisplayOrder = 1, Width = 60, Type = ColumnType.Text },
new ColumnOptions{ Id = "Name", DisplayName = "Name", DisplayOrder = 2, Width = 400, Type = ColumnType.Text }
};
var columns = ListViewHelper.ToNSTableColumns (columnNames);
foreach (var column in columns) {
tableView.AddColumn (column);
}
tableView.DataSource = listView;
tableView.ReloadData ();
}
示例7: ReloadTableView
private void ReloadTableView(NSTableView tableView, Dictionary<string,string> datasource)
{
foreach(NSTableColumn column in tableView.TableColumns())
{
tableView.RemoveColumn (column);
}
tableView.Delegate = new TableDelegate ();
var columnNames = new List<ColumnOptions> {
new ColumnOptions{ Id = "Name", DisplayName = "Name", DisplayOrder = 1, Width = 80 },
new ColumnOptions{ Id = "Value", DisplayName = "Value", DisplayOrder = 2, Width = 200 }
};
var columns = ListViewHelper.ToNSTableColumns (columnNames);
foreach (var column in columns) {
tableView.AddColumn (column);
}
var listView = new DictionaryDataSource { Entries = datasource.Keys.ToList(), Datasource = datasource };
tableView.DataSource = listView;
tableView.ReloadData ();
}
示例8: AwakeFromNib
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
UserDto = UserDtoOriginal.DeepCopy ();
Groups = new List<GroupDto> (GroupsOriginal);
TxtUsername.StringValue = UserDto.Name == null ? string.Empty : UserDto.Name;
TxtFirstName.StringValue = UserDto.PersonDetails.FirstName == null ? string.Empty : UserDto.PersonDetails.FirstName;
TxtLastName.StringValue = UserDto.PersonDetails.LastName == null ? string.Empty : UserDto.PersonDetails.LastName;
TxtEmail.StringValue = UserDto.PersonDetails.EmailAddress == null ? string.Empty : UserDto.PersonDetails.EmailAddress;
TxtDescription.StringValue = UserDto.PersonDetails.Description == null ? string.Empty : UserDto.PersonDetails.Description;
if (UserDto.PasswordDetails != null) {
TxtPasswordLastChanged.StringValue = DateTimeHelper.UnixToWindows ((long)UserDto.PasswordDetails.LastSet).ToString ("dd-MMM-yyyy hh:mm:ss");
TxtPasswordDaysUntilExpiry.StringValue = SecondsToDaysAndHours (UserDto.PasswordDetails.Lifetime);
}
ChDisabled.StringValue = UserDto.Disabled ? "0" : "1";
//Window.Title = UserDto.Name + "@" + UserDto.Domain + " Properties";
ChActAsUser.StringValue = UserDto.ActAsUsers ? "1" : "0";
ChIdpAdmin.StringValue = UserDto.IsIdpAdmin ? "1" : "0";
RdoRoleGroup.SelectCell (new NSCell (UserDto.Role.ToString ()));
lstGroups = new NSTableView ();
lstGroups.Delegate = new TableDelegate ();
this.LstGroupMembershipView.AddSubview (lstGroups);
var listView = new GroupsDataSource { Entries = Groups };
var columnNames = new List<ColumnOptions> {
new ColumnOptions{ Id = "Name", DisplayName = "Group Name", DisplayOrder = 1, Width = 300 }
};
var columns = ListViewHelper.ToNSTableColumns (columnNames);
foreach (var column in columns) {
lstGroups.AddColumn (column);
}
lstGroups.DataSource = listView;
lstGroups.ReloadData ();
//Events
this.BtnSave.Activated += OnClickSaveButton;
this.BtnAddGroup.Activated += OnClickAddGroupButton;
this.BtnRemoveGroup.Activated += OnClickRemoveGroupButton;
// this.BtnClose.Activated += (object sender, EventArgs e) => {
// this.Close ();
// NSApplication.SharedApplication.StopModalWithCode (0);
// };
}
示例9: InitializeSubtitleTable
private void InitializeSubtitleTable(NSTableView table)
{
var columns = table.TableColumns();
columns[0].SetIdentifier(SubtitleTableDelegate.CellIdentifiers[0]);
columns[0].MinWidth = 20;
columns[0].MaxWidth = 100;
columns[0].Width = 40;
columns[0].Title = Configuration.Settings.Language.General.LineNumber;
columns[1].SetIdentifier(SubtitleTableDelegate.CellIdentifiers[1]);
columns[1].MinWidth = 50;
columns[1].MaxWidth = 200;
columns[1].Width = 90;
columns[1].Title = Configuration.Settings.Language.General.StartTime;
table.AddColumn(new NSTableColumn(SubtitleTableDelegate.CellIdentifiers[2])
{
MinWidth = 50,
MaxWidth = 200,
Width = 90,
Title = Configuration.Settings.Language.General.EndTime,
});
table.AddColumn(new NSTableColumn(SubtitleTableDelegate.CellIdentifiers[3])
{
MinWidth = 40,
MaxWidth = 150,
Width = 60,
Title = Configuration.Settings.Language.General.Duration,
});
table.AddColumn(new NSTableColumn(SubtitleTableDelegate.CellIdentifiers[4])
{
MinWidth = 100,
MaxWidth = 90000,
Width = 1000,
Title = Configuration.Settings.Language.General.Text,
});
ShowSubtitle();
}
示例10: InitializeRulesTable
private void InitializeRulesTable(NSTableView table)
{
var columns = table.TableColumns();
columns[0].SetIdentifier(FixCommonErrorsTableDelegate.CellIdentifiers[0]);
columns[0].MinWidth = 50;
columns[0].MaxWidth = 200;
columns[0].Width = 60;
var bc = new NSButtonCell();
bc.SetButtonType(NSButtonType.OnOff);
columns[0].Title = Configuration.Settings.Language.MultipleReplace.Enabled;
columns[1].SetIdentifier(FixCommonErrorsTableDelegate.CellIdentifiers[1]);
columns[1].MinWidth = 100;
columns[1].MaxWidth = 600;
columns[1].Width = 250;
columns[1].Title = Configuration.Settings.Language.MultipleReplace.FindWhat;
table.AddColumn(new NSTableColumn(FixCommonErrorsTableDelegate.CellIdentifiers[2])
{
MinWidth = 100,
MaxWidth = 2000,
Width = 250,
Title = Configuration.Settings.Language.MultipleReplace.ReplaceWith,
});
_fixActions = InitializeRules();
ShowFixRules();
}
示例11: InitializeRulesTable
private void InitializeRulesTable(NSTableView table)
{
var columns = table.TableColumns();
columns[0].SetIdentifier(MultipleRulesTableDelegate.CellIdentifiers[0]);
columns[0].MinWidth = 50;
columns[0].MaxWidth = 200;
columns[0].Width = 60;
var bc = new NSButtonCell();
bc.SetButtonType(NSButtonType.OnOff);
columns[0].Title = Configuration.Settings.Language.MultipleReplace.Enabled;
columns[1].SetIdentifier(MultipleRulesTableDelegate.CellIdentifiers[1]);
columns[1].MinWidth = 100;
columns[1].MaxWidth = 600;
columns[1].Width = 250;
columns[1].Title = Configuration.Settings.Language.MultipleReplace.FindWhat;
table.AddColumn(new NSTableColumn(MultipleRulesTableDelegate.CellIdentifiers[2])
{
MinWidth = 100,
MaxWidth = 2000,
Width = 250,
Title = Configuration.Settings.Language.MultipleReplace.ReplaceWith,
});
table.AddColumn(new NSTableColumn(MultipleRulesTableDelegate.CellIdentifiers[3])
{
MinWidth = 100,
MaxWidth = 2000,
Width = 250,
Title = Configuration.Settings.Language.MultipleReplace.SearchType,
});
_rulesContextMenuDelete.Activated += (object sender, EventArgs e) =>
{
var index = (int)_rulesTable.SelectedRow;
if (index >= 0 && index < MultipleSearchAndReplaceList.Count)
{
MultipleSearchAndReplaceList.RemoveAt(index);
ShowRules(MultipleSearchAndReplaceList);
if (index >= MultipleSearchAndReplaceList.Count)
{
index--;
}
if (index >= 0)
{
_rulesTable.SelectRow((nint)index, false);
}
}
};
_rulesContextMenuMoveUp.Activated += (object sender, EventArgs e) =>
{
var index = (int)_rulesTable.SelectedRow;
if (index > 0 && index < MultipleSearchAndReplaceList.Count)
{
var item = MultipleSearchAndReplaceList[index];
MultipleSearchAndReplaceList.RemoveAt(index);
MultipleSearchAndReplaceList.Insert(index - 1, item);
ShowRules(MultipleSearchAndReplaceList);
_rulesTable.SelectRow((nint)index - 1, false);
}
};
_rulesContextMenuMoveDown.Activated += (object sender, EventArgs e) =>
{
var index = (int)_rulesTable.SelectedRow;
if (index >= 0 && index < MultipleSearchAndReplaceList.Count - 1)
{
var item = MultipleSearchAndReplaceList[index];
MultipleSearchAndReplaceList.RemoveAt(index);
MultipleSearchAndReplaceList.Insert(index + 1, item);
ShowRules(MultipleSearchAndReplaceList);
_rulesTable.SelectRow((nint)index + 1, false);
}
};
}
示例12: SelectEncodingPanel
//.........这里部分代码省略.........
var labelSize = label.Frame.Size;
var labelBottom = size.Height - 12 - labelSize.Height;
label.Frame = new CGRect (12, labelBottom, labelSize.Width, labelSize.Height);
view.AddSubview (label);
var moveButtonWidth = 32;
var tableHeight = labelBottom - buttonAreaTop - padding;
var tableWidth = size.Width / 2 - padding * 3 - moveButtonWidth + padding / 2;
allTable = new NSTableView (new CGRect (padding, buttonAreaTop, tableWidth, tableHeight));
allTable.HeaderView = null;
var allScroll = new NSScrollView (allTable.Frame) {
BorderType = NSBorderType.BezelBorder,
AutohidesScrollers = true,
HasVerticalScroller = true,
DocumentView = allTable,
};
view.AddSubview (allScroll);
nfloat center = (size.Width + padding) / 2;
var selectedLabel = CreateLabel (GettextCatalog.GetString ("Encodings shown in menu:"));
var selectedLabelSize = selectedLabel.Frame.Size;
selectedLabel.Frame = new CGRect (center, labelBottom, selectedLabelSize.Width, selectedLabelSize.Height);
view.AddSubview (selectedLabel);
selectedTable = new NSTableView (new CGRect (center, buttonAreaTop, tableWidth, tableHeight));
selectedTable.HeaderView = null;
var selectedScroll = new NSScrollView (selectedTable.Frame) {
BorderType = NSBorderType.BezelBorder,
AutohidesScrollers = true,
HasVerticalScroller = true,
DocumentView = selectedTable,
};
view.AddSubview (selectedScroll);
var buttonLevel = tableHeight / 2 + buttonAreaTop;
var goRightImage = NSImage.ImageNamed ("NSGoRightTemplate");
addButton = new NSButton (
new CGRect (tableWidth + padding * 2, buttonLevel + padding / 2,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2192",
BezelStyle = NSBezelStyle.SmallSquare,
Image = goRightImage
};
addButton.Activated += Add;
view.AddSubview (addButton);
removeButton = new NSButton (
new CGRect (tableWidth + padding * 2, buttonLevel - padding / 2 - moveButtonWidth,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2190",
BezelStyle = NSBezelStyle.SmallSquare,
Image = NSImage.ImageNamed ("NSGoLeftTemplate"),
};
removeButton.Activated += Remove;
view.AddSubview (removeButton);
upButton = new NSButton (
new CGRect (center + tableWidth + padding, buttonLevel + padding / 2,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2191",
BezelStyle = NSBezelStyle.SmallSquare,
Image = MakeRotatedCopy (goRightImage, 90),
};
upButton.Activated += MoveUp;
view.AddSubview (upButton);
downButton = new NSButton (
new CGRect (center + tableWidth + padding, buttonLevel - padding / 2 - moveButtonWidth,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2193",
BezelStyle = NSBezelStyle.SmallSquare,
Image = MakeRotatedCopy (goRightImage, -90),
};
downButton.Activated += MoveDown;
view.AddSubview (downButton);
var allColumn = new NSTableColumn {
DataCell = new NSTextFieldCell { Wraps = true },
Width = tableWidth
};
allTable.AddColumn (allColumn);
allTable.DataSource = allSource = new EncodingSource (TextEncoding.SupportedEncodings);
allTable.Delegate = new EncodingAllDelegate (this);
var selectedColumn = new NSTableColumn {
DataCell = new NSTextFieldCell { Wraps = true },
Width = tableWidth
};
selectedTable.AddColumn (selectedColumn);
selectedTable.DataSource = selectedSource = new EncodingSource (TextEncoding.ConversionEncodings);
selectedTable.Delegate = new EncodingSelectedDelegate (this);
UpdateButtons ();
this.ContentView = view;
}
示例13: InitialiseDefaultTableView
private void InitialiseDefaultTableView ()
{
MainTableView = splitViewController.MainTableView;
RemoveTableColumns ();
//Populate appropriate columns
NSTableColumn col = new NSTableColumn ("Key");
col.HeaderCell.Title = "Attribute";
col.HeaderCell.Alignment = NSTextAlignment.Center;
col.DataCell = new NSBrowserCell ();
col.MinWidth = 200;
col.ResizingMask = NSTableColumnResizing.UserResizingMask;
MainTableView.AddColumn (col);
NSTableColumn col1 = new NSTableColumn ("Value");
col1.HeaderCell.Title = "Value";
col1.ResizingMask = NSTableColumnResizing.UserResizingMask;
col1.HeaderCell.Alignment = NSTextAlignment.Center;
col1.MinWidth = 200;
MainTableView.AddColumn (col1);
MainTableView.Delegate = new GenericTableDelegate ();
}