As per the following documentation, the data for TableView is manually populated with one by one. Is there a way to feed collection and items and set the template for the item.
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/tableview
Related
Is there any way currently to select items and apply an action on multiple items in a list or datagrid?
Datagrid has options for selecting items even multiselect but i can only manage to get the relative indexes of the items in the current list not the data objects.
I could create an action to lookup up the items given the index and then store it in redux state and later apply the action. But it feels very prone to errors passing around array indexes.
If i could choose the datagrid would have a selectedRows callback that passed back the full dataitems, dispatching an action on the item id's would then be simple.
This feature isn't implemented yet, but a Pull Request is open about selectable / bulk actions.
https://github.com/marmelab/admin-on-rest/pull/1241
I am using Xamarin forms and my app has a list of items as a list view and each list item need to have a Picker. How do I bind data to the Picker controllers? Is there a way to access the child items inside a list view?
Just define your data template for the list view as normal (there are a lot of examples for this on the web), then inside the item template bind the desired item to a picker control (also a lot of examples out there).
There shouldn't be anything special about it.
I have a view-based NSTableView driven by an NSArrayController bound to a NSMutableArray as the content array.
When I add a new item to the data source, tableView:viewForTableColumn:row: is called for every item in the data source. I would expect the table view to leave existing items alone, and only call this for the new item.
I add a new item via the controller, like this:
[_arrayController addObject:newObject];
How do I prevent the table view from doing this? The performance impact is unacceptable.
Edit: It also clears the user selection
I have a Cocoa app with a similar layout like Mail.app:
A source list on the left where the user can select one of multiple entries
A detail table view in the main content area showing a list based on the selected item on the left
I'd like the selection in the detail table view to be maintained separately for each master item.
Currently I have only one detail table view and one array controller. When the master selection changes, I update the contents binding for the detail array controller.
I think I may need multiple detail array controllers -- one for each entry in the master list.
Is there an easier way/recommended pattern to do this?
You need an array controller for each table. For each detail array controller, you need to bind the contents binding to the selectedObjects key of the master array controller.
So if you had three array controllers, master, detail1 and detail2, then the content binding of detail1 should be set to master using a key path of selectedObjects.
The content binding of detail2 should be set to detail1, also using a key path of selectedObjects.
You don't need to change the contents binding programmatically.
I haven't been able to successfully bind some test data to a SketchFlow ComboBox. I added a sample data source and created a collection with some basic string values. There are a number of tutorials on how to bind to a ListBox in SketchFlow and that works fine, just not finding anything for a ComboBox.
One thing that caught me out a few times is that you need to have your data in "list mode" before you drag it on to the control (combo box or list box).
It seems to work as I expected, so perhaps I'm not understanding your issue correctly, but I'll give it a shot! I created a sample DataSource with a couple of strings in it, added a ComboBox to the layout root and then just dragged the Collection from the DataSource and dropped it on the ComboBox.
Keep in mind that if you drag the DataSource itself, you'll only be setting the DataContext property of the ComboBox and that's not enough to get your items to display. You also need the ItemsSource bound to the Collection of the DataSource and an ItemTemplate or a DisplayMemberPath to tell the ComboBox how to display your items.
Additionally, if you use the drag and drop method of binding, it will use the ItemTemplate approach for you, which may or may not be what you want as it will generally create a StackPanel and display all fields from the row in your Collection per item in the ComboBox. You can remove the ItemTemplate and set DisplayMemberPath to whichever field you wish to have displayed from your data source's collection.