Add Family size table watching#236
Conversation
…-table-view # Conflicts: # source/RevitLookup/Core/ComponentModel/Descriptors/FamilySizeTableDescriptor.cs
…family-size-tables-support-add-table-view
| contextMenu.AddMenuItem() | ||
| .SetHeader("Show table") | ||
| .SetAvailability(table.IsValidObject) | ||
| .SetCommand(table, async _ => |
There was a problem hiding this comment.
Pass sizeTable lambda params instead of discard param
.SetCommand(table, async **sizeTable** =>
{
...
var dialog = new FamilySizeTableDialog(context.ServiceProvider, **sizeTable**);Because you pass table as parameter to the command
| #if REVIT2022_OR_GREATER | ||
| unitsArray[i] = UnitUtils.IsUnit(typeId) ? typeId.ToUnitLabel() : typeId.ToGroupLabel(); | ||
| #else | ||
| unitsArray[i] = UnitUtils.IsUnit(typeId) ? typeId.ToUnitLabel() : "Other"; | ||
| #endif |
There was a problem hiding this comment.
Instead of UnitUtils.IsUnit(typeId) you need to use typeId.Empty() check and remove REVIT2022_OR_GREATER directive
| { | ||
| for (var i = 0; i < columnsCount; i++) | ||
| { | ||
| Columns.Add(new DataColumn(_table.GetColumnHeader(i).Name)); |
There was a problem hiding this comment.
We can add unit in column header ? like .csv file?
private void CreateColumns(FamilySizeTable table)
{
for (var i = 0; i < table.NumberOfColumns; i++)
{
var typeId = table.GetColumnHeader(i).GetUnitTypeId();
var headerName = table.GetColumnHeader(i).Name;
var columnName = typeId.Empty() ? headerName : $"{headerName}##{typeId.ToUnitLabel()}";
Columns.Add(new DataColumn(columnName, typeof(string)));
}
}| <DataGrid | ||
| HorizontalScrollBarVisibility="Visible" | ||
| ItemsSource="{Binding}" | ||
| AutoGenerateColumns="True"/> |
There was a problem hiding this comment.
AutoGenerateColumns true by default, can remove it
| CanContentScroll="True" | ||
| d:DataContext="{d:DesignInstance dialogs:FamilySizeTableDialogViewModel}"> | ||
| <DataGrid | ||
| HorizontalScrollBarVisibility="Visible" |
There was a problem hiding this comment.
IsReadOnly="True"
HeadersVisibility="Column"
CanUserReorderColumns="False"
We can add those properties for better readability and remove scrollViewer because DataGrid has scroll by default in the template
| Height="Auto" | ||
| MinWidth="416" |
There was a problem hiding this comment.
we can remove it, the content takes up all available space
| Title = "Family size table", | ||
| Content = this, | ||
| CloseButtonText = "Close", | ||
| DialogMaxWidth = 1500 |
There was a problem hiding this comment.
I guess it's better to remove the max width if we want to see large horizontal tables in the full screen mode
|
@SergeyNefyodov I've cleaned the code a bit on the comments above, it looks like: Maybe the drawback is the Column1 name for the first column, but DataTable doesn't support empty name |


Summary of the Pull Request
What is this about:
I added a possibility to watch read-only FamilySizeTable by clicking context menu, using dialogs
Quality Checklist