diff --git a/components/filemanager/events.md b/components/filemanager/events.md index e33375b3f4..6aa6278a24 100644 --- a/components/filemanager/events.md +++ b/components/filemanager/events.md @@ -21,6 +21,7 @@ This article explains the events available in the Telerik FileManager for Blazor * [Other Events](#other-events) - other events the grid provides. * [OnModelInit](#onmodelinit) * [OnDownload](#ondownload) + * [PathChanged](#pathchanged) * [SelectedItemsChanged](#selecteditemschanged) * [ViewChanged](#viewchanged) @@ -348,6 +349,10 @@ A FileManager in a WebAssembly app usually displays files from a remote server. 1. The server returns the file content. 1. The `OnDownload` handler puts the returned file content to a `MemoryStream` and assigns it to `args.Stream`. +### PathChanged + +The `PathChanged` event fires when the user navigates to a different folder through the TreeView or by double-clicking a folder item in the [FileManager View]({%slug filemanager-views%}). The event handler receives the new path as a `string` argument. + ### SelectedItemsChanged The `SelectedItemChanged` event fires every time the user clicks on a new file/folder in the main pane of the FileManager. You can use it with one-way binding of the `SelectedItems` parameter to respond to user selection. @@ -364,7 +369,8 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager @using System.IO x.IsDirectory && x.Path == path); return directory; } - private FlatFileEntry GetParent(FlatFileEntry currItem, string currDirectory) + private FlatFileEntry? GetParent(FlatFileEntry currItem, string currDirectory) { var parentItem = Files .FirstOrDefault(x => x.IsDirectory && x.Path == currDirectory); @@ -445,7 +451,7 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager private async Task OnUpdateHandler(FileManagerUpdateEventArgs args) { - var item = args.Item as FlatFileEntry; + var item = (FlatFileEntry)args.Item; if (item.IsDirectory) { @@ -466,6 +472,8 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager updatedItem.Path = Path.Combine(DirectoryPath, fullName); Console.WriteLine(updatedItem.Path); } + + await Task.Delay(1); // simulate async operation } private async Task OnDownloadHandler(FileManagerDownloadEventArgs args) @@ -481,6 +489,7 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager FlatFileEntry actualFile = (FlatFileEntry)args.Item; + await Task.Delay(1); // simulate async operation string dummyFileContent = $"This file is a dummy version of {actualFile.Name}. It was downloaded with the Telerik Blazor FileManager."; byte[] dummyFileBuffer = System.Text.Encoding.UTF8.GetBytes(dummyFileContent); @@ -491,13 +500,13 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager private async Task OnDeleteHandler(FileManagerDeleteEventArgs args) { - var currItem = args.Item as FlatFileEntry; + var item = (FlatFileEntry)args.Item; - var itemToDelete = Files.FirstOrDefault(x => x.Id == currItem.Id); + var itemToDelete = Files.FirstOrDefault(x => x.Id == item.Id); Files.Remove(itemToDelete); - RefreshData(); + await RefreshData(); } private FlatFileEntry OnModelInitHandler() @@ -516,14 +525,20 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager return item; } + private void OnPathChanged(string newPath) + { + DirectoryPath = newPath; + } + private void OnSelect(IEnumerable selectedFiles) { // Update the view model. SelectedItems = selectedFiles; } - private void RefreshData() + private async Task RefreshData() { + await Task.Delay(1); // simulate async operation Files = new List(Files); } @@ -534,12 +549,12 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager public class FlatFileEntry { - public string Id { get; set; } - public string ParentId { get; set; } - public string Name { get; set; } + public string Id { get; set; } = string.Empty; + public string? ParentId { get; set; } + public string Name { get; set; } = string.Empty; public long Size { get; set; } - public string Path { get; set; } - public string Extension { get; set; } + public string Path { get; set; } = string.Empty; + public string Extension { get; set; } = string.Empty; public bool IsDirectory { get; set; } public bool HasDirectories { get; set; } public DateTime DateCreated { get; set; } @@ -674,6 +689,8 @@ The `ViewChanged` event fires when the user toggles between the [two FileManager gridDesign }; + await Task.Delay(1); // simulate async operation + return files; } } diff --git a/components/multiselect/overview.md b/components/multiselect/overview.md index d2587c52f9..905d0a8b75 100644 --- a/components/multiselect/overview.md +++ b/components/multiselect/overview.md @@ -111,6 +111,7 @@ The Blazor MultiSelect provides various parameters that allow you to configure t | `MinLength` | `int` | How many characters the user must type before the suggestion list appears. Often works together with [filtering]({%slug multiselect-filter%}). | | `PersistFilterOnSelect` | `bool` | Controls whether the filter input will be cleared when the user selects an item. Applies when [MultiSelect filtering]({%slug multiselect-filter%}) is enabled and `AutoClose="false"`. | `Placeholder` | `string` | The text the user sees as a hint when there is no selection. | +| `ShowArrowButton` | `bool` | Controls whether the MultiSelect will show an arrow button, which hints about its dropdown. When enabled, an empty MultiSelect component looks similar to a ComboBox, otherwise it looks similar to a TextBox. | | `TextField` | `string`
(`Text`)| The field in the model from which the text of the items is taken. | | `TItem` | `Type` | The type of the model to which the component is bound. Required if you can't provide `Data` or `Value`. Determines the type of the reference object. | | `TValue` | `Type` | The type of the value field in the model to which the component is bound. Required if you can't provide `Data` or `Value`. Determines the type of the reference object. The type of the values can be:
- `number` (such as `int`, `double`, and so on)
- `string`
- `Guid`
- `Enum` |