ExplorerControl with file preview

1 Answer 36 Views
FileDialogs
Dominic
Top achievements
Rank 1
Dominic asked on 18 Jan 2024, 11:07 AM

Hi,

I used ExplorerControl to create a custom FileOpen Dialog.

Now I want to include a file preview when clicking on a file of specific type.
Unfortunately I cannot find a way to get notified by a change of selected Filename.

Is there a way to do that?

 

Best Regards,

Dominic

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 22 Jan 2024, 10:49 AM

Hello Dominic,

Currently, the RadFileDialogs don't have selection API, so there is no event that you can use to get notified when the selected file is changed. However, there is a feature request to introduce such API.

You can also use the following custom code to listen for changes in the selection.

static MyCustomDialogWindow()
{
    EventManager.RegisterClassHandler(typeof(FileBrowserListBox), FileBrowserListBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnFileBrowserListBoxSelectionChanged));
    EventManager.RegisterClassHandler(typeof(FileBrowserGridView), FileBrowserGridView.SelectionChangedEvent, new EventHandler<Telerik.Windows.Controls.SelectionChangeEventArgs>(OnFileBrowserGridViewSelectionChanged));            
}

private static void OnFileBrowserGridViewSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
{
    if (e.AddedItems.Count > 0)
    {
        var selectedItem = (FileSystemInfoWrapper) e.AddedItems[0];
    }   
}

private static void OnFileBrowserListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    if (e.AddedItems.Count > 0)
    {
        var selectedItem = (FileSystemInfoWrapper) e.AddedItems[0];
        // the FileSystemInfoWrapper can be a FileInforWrapper or DirectoryInfoWrapper
    }
}

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Dominic
Top achievements
Rank 1
commented on 22 Jan 2024, 02:43 PM

Thank You Martin,

this is exactly what I was looking for...

Best Regards,

Dominic

Tags
FileDialogs
Asked by
Dominic
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or