private void GetData() { var dt = new DataTable(); dt.Columns.Add("Schedule Item", typeof (string)); dt.Columns.Add("Job Section", typeof (string)); dt.Columns.Add("Long Description", typeof (string));
dt.Columns.Add("Short Description", typeof (string)); dt.Columns.Add("Base Rate", typeof (double)); dt.Columns.Add("Unit", typeof (string)); dt.Columns.Add("Quantity", typeof (int)); dt.Columns.Add("Total Price", typeof (double), "[Base Rate] * [Quantity]"); var items = new[] { "Whole Premises", "Hallway/Entrance", "Lounge", "Kitchen", "Bathroom", "Bedroom1", "Bedroom2", "Bedroom3", "Additions", "Omissions" }; xamDataGrid.DataSource = dt.DefaultView; foreach (var record in xamDataGrid.Records) { record.IsExpanded = true; } }
I want to add a button and when i click on it .. it will hide the long description Column and runtime ..
How can i do this ?
Thanks in advance
With XAML?? Possible??
Hello,
You can set the Visibility property of that field like:
xamDataGrid1.FieldLayouts[0].Fields["Long Description"].Visibility = Visibility.Collapsed;