Skip to content

Column view like in MC? #3006

Answered by tznind
aloneguid asked this question in Q&A
Nov 21, 2023 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

In v2_develop I removed the coupling of TableView from DataTable. You can define your own columns with EnumerableTableSource<>. You can use the alpha nuget package or link the source repo directly for the latest changes.

	Application.Init ();
	var w = new Window ();

	var currentDir = new DirectoryInfo (Environment.CurrentDirectory);
	
	var fsi = currentDir.GetFileSystemInfos ();
	var source = new EnumerableTableSource<FileSystemInfo> (fsi,
		new Dictionary<string, Func<FileSystemInfo, object>> {
			{ "Name",(f)=>f.Name},
			{ "Size",(f)=>f is FileInfo fi ? fi.Length : ""},
			{ "Mod",(f)=>f.LastWriteTime},
		});

	var tv = new TableView (source) {
		Width = Dim.Fill (),
		Height = Dim.Fill 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@aloneguid
Comment options

@tznind
Comment options

tznind Nov 21, 2023
Collaborator

Answer selected by aloneguid
@aloneguid
Comment options

@tznind
Comment options

tznind Nov 27, 2023
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants