Hi,
The same code that uses the Modal control in the commercial version of the Autocomplete control will show an exception, and the following is the code block
<Button Color="Color.Primary" Clicked="@ShowModal" >@L["Approval"]</Button>
<Modal @ref="modalRef">
<ModalContent Centered>
<ModalHeader>
<ModalTitle>Employee edit</ModalTitle>
<CloseButton />
</ModalHeader>
<ModalBody>
<Field>
<FieldLabel>Name</FieldLabel>
<TextEdit Placeholder="Enter name..." />
</Field>
<Field>
<FieldLabel>Surname</FieldLabel>
<TextEdit Placeholder="Enter surname..." />
</Field>
<Autocomplete TItem="Country"
TValue="string"
Data="@Countries"
TextField="@(( item ) => item.Name)"
ValueField="@(( item ) => item.NameValue)"
Placeholder="Search..."
Multiple
FreeTyping
@bind-SelectedValues="multipleSelectionData"
@bind-SelectedTexts="multipleSelectionTexts">
</Autocomplete>
</ModalBody>
<ModalFooter>
<Button Color="Color.Secondary" Clicked="@HideModal">Close</Button>
<Button Color="Color.Primary" Clicked="@HideModal">Save Changes</Button>
</ModalFooter>
</ModalContent>
</Modal>
public class Country
{
public string Name { get; set; }
public string NameValue { get; set; }
}
private Modal modalRef;
public IEnumerable<Country> Countries;
protected override async Task OnInitializedAsync()
{
multipleSelectionData = new List<string>() { };
await base.OnInitializedAsync();
}
List<string> multipleSelectionData;
List<string> multipleSelectionTexts = new();
private async Task ShowModal()
{
await modalRef.Show();
}
private Task HideModal()
{
return modalRef.Hide();
}