I have a xaml grid defined as:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid>
The first column will contain a TextBlock and the second column a TextBox for data capture. How can I toggle the visibility of first column?
To hide a column from the GridControl, set the BaseColumn. Visible property to false. To hide column from the Column Chooser, set the column's ColumnBase. ShowInColumnChooser property to false.
Simply do this: rowToHide. Height = new GridLength(0);
Try setting both column definition widths to "Auto". Then in the xaml content for column 2, set it's Visibility to collapsed - this should hide it. When you set it to visible it should show with it's size determined by it's contents. You can give the column a name, and the reference the column in code behind.
The solution to my problem was to change the width of the first column to "Auto". Then I set up the bindings of my first textbox so that its Visibility property was set to Collapsed (not hidden) which results in the column not being rendered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With