How can one dynamically modify row and column definitions of a WPF grid? - wpf

I have two dimensional data with varying number of rows and columns and must display it to the user for editing. The format of the data itself is essentially described by a list of row and column descriptors with a header text for each row or column.
I derived a control from Grid that has two properties for the row and column descriptors and builds the gird rows and columns based on that information. It also subscribes list change events of the two descriptor collection to update itself if the user dynamically adds or removes rows or columns.
And here the problem occurs - when I try to modify the row or column definitions of the gird I get an exception telling that the collection is read-only. So I assume it is not possible to modify the definition after the grid has been created and shown once. Any ideas?
And just in the case it matters - everything is data bound. There is a (dynamic) collection of tables with each table containing its own (dynamic) row and column definitions and the data entered for each cell.

I did a quick test and I could add rows and columns without problems to a Grid at runtime through code, using the RowDefinitions and ColumnDefinitions collections. I don't think that bindings have something to do with the problem either.
If on the other hand you meant DataGrid, yes, that changes things quite a bit.

Related

How to show two data set result together horizontally in BIP report

I have two data set from different fact tables but in report I have to show both the result set together.
If I am using both the data sets it is appending down after the first dataset table.
Please let me know how can I show both the tables together horizontally.
Report
RTF
Output
Nested Tables.
Make a new table in your template; 1 row, two columns.
Nest/put one of your tables in the first columns of the new table. Put your other table in the second column of the new table.
If you want, you can adjust the new tables cell margins to different values, including 0, to reduce the space around the nested tables.

Bind tablix with a single row of out of many rows returned by dataset in SSRS 2008?

I am fully aware that ideally, dataset should return only relevant rows with which to bind tablix.
However, in this particular case, I am utilizing same dataset to bind multiple tables and need to perform some filtering 'on the fly'.
I tried writing logic in column visibility of each cell to achieve desired output but there is no unique condition available on cell level .
I need to bind only single row from the dataset based on my unique column value, any pointers will be highly appreciated, thanks !
Although you haven't provided any code/data samples but may be you can utilize row visibility property to filter rows from dataset with which to bind individual tables as suggested here

How to save the changes made in the NSTableView back to the source array used for the populating this table?

I have view based NSTableView with two columns. Instead of default NSTextFields I have inserted NSTextViews. For populating the table I am using the array of tuples of two strings. After I change the text in the NSTextViews I want to save back all changes from all rows and columns to the source array by clicking the button. I need to know each row and NSTextViews to get the strings for the array. How to do this ? First problem is that I cannot even make the tags for particular NSTextViews, they are inactive in Attributes Inspector (for NSTextFields tags are active).

ShieldUI Grid row count

In ShieldUI (1.7.13) Grid
How can I have a row count beside each record in a grid?
This is not data from the JSON which provides the other data for the Grid.
Situation, I am scrolling a list of hundreds of records and want to provide the consumer of the data the row number of the various rows in the grid.
Similar to the row number in any popular spreadsheet application (Excel, Google Sheets, etc.)
You can add a new column as the first one, specifying a custom columnTemplate for it. In there you can show the current index of each row.
More information is available here:
https://www.shieldui.com/documentation/grid/javascript/api/settings/columns/columnTemplate

How do I disallow incomplete rows from being added in my DataGrid?

I have a DataGrid (currently the .NET 3.5 WPFToolkit version, but I can use the .NET 4.0 out-of-the-box DataGrid if needed) bound to a collection of objects. Three of the columns in the data grid represent pieces of information used as a key to grab other information from the database. This other information is used in calculations to populate other columns of the data grid.
Once the user enters these three fields, and the combination of the data in those fields exists in the database, the row is considered valid for adding to collection. The user is also now allowed to freely edit the other columns in the row. Once any other column is given data by the user, the three "key" fields are considered "locked" - the user may no longer edit them. The only way to change that information is to delete the entire row and add a new row.
1) What is the best way from a UX perspective to handle this? Should I allow the user to enter data in any column, "cache" their entries, then do my calculations all at once only after the "key" data is entered? Or should I restrict the user to only enter the "key" data first, then allow the user to enter data in the other columns?
2) What is the strategy (event handlers I need, etc.) for implementing the above in the data grid? How do I not allow the new row to be added to the data bound collection until it has valid "key" data, or do I allow the new row to be added with validation errors and somehow track that it is ok for the user to continue editing the "key" columns of the partially complete row, but not other existing rows in the data grid?
This is what I did for my particular situation:
1) The best way to handle this is to give the user the most flexibility possible. This means allowing the user to edit the key data under certain conditions, but not restricting the user to entering key data first.
2) The strategy for implementing that has two parts. First, define when the use is not allowed to edit the key data anymore, and add styles to the datagrid columns that switch the key value columns to a read-only mode based on a trigger. Second, when key data is changed, perform all of the logic behind-the-scene as if the row were deleted using the old key data and then created using the new key data. This will cover all of the side-effects I need to have happen.

Resources