This is a migrated thread and some comments may be shown as answers.

Adjust columns in detail view

1 Answer 128 Views
FileDialogs
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 26 Jul 2019, 02:55 PM

When using the detail view, the default column width is too wide. Is it possible to set the width before the dialog is shown?

I would also prefer that the column header text be left justified.

The first image shows how it looks now and the second image shows how I want it to look.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Jul 2019, 08:35 AM
Hello, Jeff,   

Note that the file dialogs use a RadListView in the explorer control for displaying the folders/files. If you need to customize the alignment of the Name header cell, it is suitable to use the CellFormatting event that RadListView offers.

As to the column's width, it is necessary to specify the Width of the column in the SaveFileDialogForm.Shown event. Please refer to the following code snippet:

public RadForm1()
{
    InitializeComponent();
 
 
    this.radSaveFileDialog1.SaveFileDialogForm.Shown += SaveFileDialogForm_Shown;
    this.radSaveFileDialog1.ShowDialog();
}
 
private void SaveFileDialogForm_Shown(object sender, EventArgs e)
{
    this.radSaveFileDialog1.SaveFileDialogForm.ExplorerControl.FileBrowserListView.CellFormatting -= FileBrowserListView_CellFormatting;
    this.radSaveFileDialog1.SaveFileDialogForm.ExplorerControl.FileBrowserListView.CellFormatting += FileBrowserListView_CellFormatting;
    this.radSaveFileDialog1.SaveFileDialogForm.ExplorerControl.FileBrowserListView.ViewType = ListViewType.DetailsView;
    this.radSaveFileDialog1.SaveFileDialogForm.ExplorerControl.LayoutType = Telerik.WinControls.FileDialogs.LayoutType.Details;
    this.radSaveFileDialog1.SaveFileDialogForm.ExplorerControl.FileBrowserListView.Columns["Label"].Width = 100;
}
 
private void FileBrowserListView_CellFormatting(object sender, ListViewCellFormattingEventArgs e)
{
    if (e.CellElement.Data.HeaderText == "Name")
    {
        e.CellElement.TextAlignment = ContentAlignment.MiddleLeft;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.TextAlignmentProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 
 
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
FileDialogs
Asked by
Jeff
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or