Class ComboBoxEvents<TValue, TItem>
Represents the event handlers for a ComboBox component in the Blazor framework.
Inheritance
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class ComboBoxEvents<TValue, TItem> : OwningComponentBase
Type Parameters
Name | Description |
---|---|
TValue | The type of value associated with the ComboBox. |
TItem | The type of item associated with the ComboBox. |
Constructors
ComboBoxEvents()
Declaration
public ComboBoxEvents()
Properties
Blur
Gets or sets the event callback that will be invoked when the ComboBox component loses focus.
Declaration
public EventCallback<object> Blur { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Closed
Gets or sets the event callback that will be invoked after the dropdown popup has been closed.
Declaration
public EventCallback<ClosedEventArgs> Closed { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<ClosedEventArgs> |
Created
Gets or sets the event callback that will be invoked when the component is created.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
CustomValueSpecifier
Gets or sets the event callback that will be invoked when custom values (not present in the data source) are selected in the ComboBox component.
Declaration
public EventCallback<CustomValueSpecifierEventArgs<TItem>> CustomValueSpecifier { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<CustomValueSpecifierEventArgs<TItem>> |
Examples
<SfComboBox TValue="int" TItem="Countries" DataSource="@CountryList">
<ComboBoxEvents TValue="int" TItem="Countries" CustomValueSpecifier="@customValue"></ComboBoxEvents>
<ComboBoxFieldSettings Text="Name" Value="Code"></ComboBoxFieldSettings>
</SfComboBox>
@code{
public class Countries {
public string Name { get; set; }
public int Code { get; set; }
}
private List<Countries> CountryList = new List<Countries>() {
new Countries(){ Code= 101, Name= "Australia" },
new Countries(){ Code= 102, Name= "Canada" }
}
private void customValue(CustomValueSpecifierEventArgs<Countries> args) {
args.Item = new Countries() { Code = 103, Name = args.Text };
}
}
DataBound
Gets or sets the event callback that will be invoked when the data source is populated in the popup list.
Declaration
public EventCallback<DataBoundEventArgs> DataBound { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<DataBoundEventArgs> |
Destroyed
Gets or sets the event callback that will be invoked when the component is destroyed.
Declaration
public EventCallback<object> Destroyed { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Filtering
Gets or sets the event callback that will be invoked on typing a character in the ComboBox.
Declaration
public EventCallback<FilteringEventArgs> Filtering { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<FilteringEventArgs> |
Remarks
Prevent the default filter action and make your query enable the PreventDefaultAction event argument, and pass the modified data source and query in the FilterAsync(IEnumerable<TItem>, Query, FieldSettingsModel) method.
Examples
<SfComboBox @ref="ComboBoxObj" TItem="string" TValue="string" AllowFiltering="true" DataSource="@MyList">
<ComboBoxEvents TValue="string" TItem="string" Filtering="@OnFilteringHandler" />
</SfComboBox>
@code{
SfComboBox<string, string> ComboBoxObj { get; set; }
protected List<string> MyList = new List<string>() { "Small", "Medium", "Large" };
public async Task OnFilteringHandler(FilteringEventArgs args) {
args.PreventDefaultAction = true;
var query = new Query().Where(new WhereFilter() { Field = "Text", Operator = "contains", value = args.Text, IgnoreCase = true });
await ComboBoxObj.FilterAsync(MyList, query);
}
}
Focus
Gets or sets the event callback that will be invoked when the component is the focus.
Declaration
public EventCallback<object> Focus { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
OnActionBegin
Gets or sets the event callback that will be invoked before fetching data from the data source.
Declaration
public EventCallback<ActionBeginEventArgs> OnActionBegin { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<ActionBeginEventArgs> |
OnActionComplete
Gets or sets the event callback that will be invoked after data is fetched suction from the data source.
Declaration
public EventCallback<ActionCompleteEventArgs<TItem>> OnActionComplete { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<ActionCompleteEventArgs<TItem>> |
OnActionFailure
Gets or sets the event callback that will be invoked when the data fetch request fails.
Declaration
public EventCallback<Exception> OnActionFailure { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Exception> |
OnClose
Gets or sets the event callback that will be invoked before the dropdown popup is closed.
Declaration
public EventCallback<PopupEventArgs> OnClose { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<PopupEventArgs> |
Remarks
Prevent the dropdown popup close action using Cancel and the popup remains opened always.
Examples
<SfComboBox TItem="string" TValue="string" DataSource="@MyList">
<ComboBoxEvents TValue="string" TItem="string" OnClose="@OnCloseHandler"/>
</SfComboBox>
@code{
protected List<string> MyList = new List<string>() { "Small", "Medium", "Large" };
public void OnCloseHandler(PopupEventArgs args) {
args.Cancel = true;
}
}
OnOpen
Gets or sets the event callback that will be invoked when the dropdown popup before it opens.
Declaration
public EventCallback<BeforeOpenEventArgs> OnOpen { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<BeforeOpenEventArgs> |
Remarks
Prevent the dropdown popup open action using Cancel.
Examples
<SfComboBox TItem="string" TValue="string" DataSource="@MyList">
<ComboBoxEvents TValue="string" TItem="string" OnOpen="@OnOpenHandler"/>
</SfComboBox>
@code{
protected List<string> MyList = new List<string>() { "Small", "Medium", "Large" };
public void OnOpenHandler(BeforeOpenEventArgs args) {
args.Cancel = true;
}
}
OnValueSelect
Gets or sets the event callback that will be invoked when an item is selected from the dropdown popup by the user either with a mouse tap or with a keyboard navigation.
Declaration
public EventCallback<SelectEventArgs<TItem>> OnValueSelect { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<SelectEventArgs<TItem>> |
Remarks
Prevent the item selection action using Cancel.
Examples
<SfComboBox TItem="string" TValue="string" DataSource="@MyList">
<ComboBoxEvents TValue="string" TItem="string" OnValueSelect="@OnSelectHandler" />
</SfComboBox>
@code{
protected List<string> MyList = new List<string>() { "Small", "Medium", "Large" };
public void OnSelectHandler(SelectEventArgs<string> args) {
if(args.ItemData== "Medium")
args.Cancel = true;
}
}
Opened
Gets or sets the event callback that will be invoked when the dropdown popup opens.
Declaration
public EventCallback<PopupEventArgs> Opened { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<PopupEventArgs> |
ValueChange
Gets or sets the event callback that will be invoked when the Value property changed.
Declaration
public EventCallback<ChangeEventArgs<TValue, TItem>> ValueChange { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<ChangeEventArgs<TValue, TItem>> |
Remarks
This event triggers when an item in a popup is selected or when the user changes the model value.
Examples
<SfComboBox TItem="string" TValue="string" DataSource="@MyList">
<ComboBoxEvents TValue="string" TItem="string" ValueChange="@OnChange"/>
</SfComboBox>
@code{
protected List<string> MyList = new List<string>() { "Small", "Medium", "Large" };
public void OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, string> args) {
var NewValue = args.Value;
}
}
Methods
ComponentDispose(Boolean)
Declaration
protected void ComponentDispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |