diff --git a/Documentation/Blazorise.Docs/Models/Snippets.generated.cs b/Documentation/Blazorise.Docs/Models/Snippets.generated.cs index a6e407904a..9903123021 100644 --- a/Documentation/Blazorise.Docs/Models/Snippets.generated.cs +++ b/Documentation/Blazorise.Docs/Models/Snippets.generated.cs @@ -7911,6 +7911,7 @@ public void CheckName( ValidatorEventArgs validationArgs ) Data=""@employeeList"" @bind-SelectedRow=""@selectedEmployee"" Responsive + RowStyling='(x,y ) => y.Style = ""height: 70px;""' Virtualize VirtualizeOptions=""@(new() { DataGridHeight = ""250px""})""> diff --git a/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Code/DataGridVirtualizeExampleCode.html b/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Code/DataGridVirtualizeExampleCode.html index b8a7197afe..6083161a0a 100644 --- a/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Code/DataGridVirtualizeExampleCode.html +++ b/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Code/DataGridVirtualizeExampleCode.html @@ -4,6 +4,7 @@ Data="@employeeList" @bind-SelectedRow="@selectedEmployee" Responsive + RowStyling='(x,y ) => y.Style = "height: 70px;"' Virtualize VirtualizeOptions="@(new() { DataGridHeight = "250px"})"> <DataGridCommandColumn /> diff --git a/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridVirtualizeExample.razor b/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridVirtualizeExample.razor index 97a839b311..b787e30aa7 100644 --- a/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridVirtualizeExample.razor +++ b/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridVirtualizeExample.razor @@ -4,6 +4,7 @@ Data="@employeeList" @bind-SelectedRow="@selectedEmployee" Responsive + RowStyling='(x,y ) => y.Style = "height: 70px;"' Virtualize VirtualizeOptions="@(new() { DataGridHeight = "250px"})"> diff --git a/Source/Blazorise/Base/BaseColumnComponent.cs b/Source/Blazorise/Base/BaseColumnComponent.cs index 1f6e2b175a..b1f25a87c5 100644 --- a/Source/Blazorise/Base/BaseColumnComponent.cs +++ b/Source/Blazorise/Base/BaseColumnComponent.cs @@ -22,7 +22,7 @@ public abstract class BaseColumnComponent : BaseComponent, IColumnComponent /// protected override void BuildClasses( ClassBuilder builder ) { - if ( ColumnSize != null && !PreventColumnSize ) + if ( ColumnSize is not null && !PreventColumnSize ) builder.Append( ColumnSize.Class( InsideGrid, ClassProvider ) ); base.BuildClasses( builder ); diff --git a/Source/Blazorise/Base/BaseComponent.cs b/Source/Blazorise/Base/BaseComponent.cs index d839aeb72a..43096c1c82 100644 --- a/Source/Blazorise/Base/BaseComponent.cs +++ b/Source/Blazorise/Base/BaseComponent.cs @@ -103,12 +103,12 @@ public override Task SetParametersAsync( ParameterView parameters ) Attributes ??= new(); - if ( widthAttribute != null && parametersDictionary.Remove( "width" ) ) + if ( widthAttribute is not null && parametersDictionary.Remove( "width" ) ) { Attributes.Add( "width", widthAttribute ); } - if ( heightAttribute != null && parametersDictionary.Remove( "height" ) ) + if ( heightAttribute is not null && parametersDictionary.Remove( "height" ) ) { Attributes.Add( "height", heightAttribute ); } @@ -122,7 +122,7 @@ public override Task SetParametersAsync( ParameterView parameters ) /// protected override void OnInitialized() { - if ( ShouldAutoGenerateId && ElementId == null ) + if ( ShouldAutoGenerateId && ElementId is null ) { ElementId = IdGenerator.Generate; } @@ -174,31 +174,31 @@ protected override ValueTask DisposeAsync( bool disposing ) /// Class builder used to append the classnames. protected virtual void BuildClasses( ClassBuilder builder ) { - if ( Class != null ) + if ( Class is not null ) builder.Append( Class ); - if ( Margin != null ) + if ( Margin is not null ) builder.Append( Margin.Class( ClassProvider ) ); - if ( Padding != null ) + if ( Padding is not null ) builder.Append( Padding.Class( ClassProvider ) ); - if ( Gap != null ) + if ( Gap is not null ) builder.Append( Gap.Class( ClassProvider ) ); - if ( Display != null ) + if ( Display is not null ) builder.Append( Display.Class( ClassProvider ) ); - if ( Border != null ) + if ( Border is not null ) builder.Append( Border.Class( ClassProvider ) ); - if ( Flex != null ) + if ( Flex is not null ) builder.Append( Flex.Class( ClassProvider ) ); - if ( Position != null ) + if ( Position is not null ) builder.Append( Position.Class( ClassProvider ) ); - if ( Overflow != null ) + if ( Overflow is not null ) builder.Append( Overflow.Class( ClassProvider ) ); if ( Float != Float.Default ) @@ -213,10 +213,10 @@ protected virtual void BuildClasses( ClassBuilder builder ) if ( VerticalAlignment != VerticalAlignment.Default ) builder.Append( ClassProvider.VerticalAlignment( VerticalAlignment ) ); - if ( Width != null ) + if ( Width is not null ) builder.Append( Width.Class( ClassProvider ) ); - if ( Height != null ) + if ( Height is not null ) builder.Append( Height.Class( ClassProvider ) ); if ( Casing != CharacterCasing.Normal ) @@ -254,7 +254,7 @@ protected virtual void BuildClasses( ClassBuilder builder ) /// Style builder used to append the styles. protected virtual void BuildStyles( StyleBuilder builder ) { - if ( Style != null ) + if ( Style is not null ) builder.Append( Style ); } diff --git a/Source/Blazorise/Base/BaseFocusableContainerComponent.cs b/Source/Blazorise/Base/BaseFocusableContainerComponent.cs index 788ba13885..ef95ffa16a 100644 --- a/Source/Blazorise/Base/BaseFocusableContainerComponent.cs +++ b/Source/Blazorise/Base/BaseFocusableContainerComponent.cs @@ -35,7 +35,7 @@ protected override async ValueTask DisposeAsync( bool disposing ) { if ( disposing && Rendered ) { - if ( focusableComponents != null ) + if ( focusableComponents is not null ) { focusableComponents.Clear(); focusableComponents = null; @@ -57,10 +57,10 @@ protected Task HandleFocusableComponent() var firstFocusableComponent = FocusableComponents.FirstOrDefault( x => x.Autofocus ); // take first component if Autofocus is unspecified - if ( firstFocusableComponent == null ) + if ( firstFocusableComponent is null ) firstFocusableComponent = FocusableComponents.FirstOrDefault(); - if ( firstFocusableComponent != null ) + if ( firstFocusableComponent is not null ) { return firstFocusableComponent.Focus(); } @@ -72,7 +72,7 @@ protected Task HandleFocusableComponent() /// public void NotifyFocusableComponentInitialized( IFocusableComponent focusableComponent ) { - if ( focusableComponent == null ) + if ( focusableComponent is null ) return; if ( !FocusableComponents.Contains( focusableComponent ) ) @@ -84,7 +84,7 @@ public void NotifyFocusableComponentInitialized( IFocusableComponent focusableCo /// public void NotifyFocusableComponentRemoved( IFocusableComponent focusableComponent ) { - if ( focusableComponent == null ) + if ( focusableComponent is null ) return; if ( FocusableComponents.Contains( focusableComponent ) ) diff --git a/Source/Blazorise/Base/BaseInputComponent.razor.cs b/Source/Blazorise/Base/BaseInputComponent.razor.cs index 2cdc84230e..86d653f08c 100644 --- a/Source/Blazorise/Base/BaseInputComponent.razor.cs +++ b/Source/Blazorise/Base/BaseInputComponent.razor.cs @@ -57,7 +57,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) if ( autofocus ) { - if ( ParentFocusableContainer != null ) + if ( ParentFocusableContainer is not null ) { ParentFocusableContainer.NotifyFocusableComponentInitialized( this ); } @@ -76,7 +76,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) /// protected override void OnInitialized() { - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed += OnThemeChanged; } @@ -111,7 +111,7 @@ protected override ValueTask DisposeAsync( bool disposing ) /// protected virtual void ReleaseResources() { - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { // To avoid leaking memory, it's important to detach any event handlers in Dispose() ParentValidation.ValidationStatusChanged -= OnValidationStatusChanged; @@ -119,7 +119,7 @@ protected virtual void ReleaseResources() ParentFocusableContainer?.NotifyFocusableComponentRemoved( this ); - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed -= OnThemeChanged; } @@ -166,7 +166,7 @@ protected async Task CurrentValueHandler( string value ) } } // send the value to the validation for processing - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { await ParentValidation.NotifyInputChanged( default ); } @@ -294,7 +294,7 @@ protected virtual Task OnFocusOutHandler( FocusEventArgs eventArgs ) /// public Task Revalidate() { - if ( ParentValidation != null ) + if ( ParentValidation is not null ) return ParentValidation.NotifyInputChanged( default ); return Task.CompletedTask; @@ -334,14 +334,14 @@ private void OnThemeChanged( object sender, EventArgs eventArgs ) protected override bool ShouldAutoGenerateId => true; /// - public virtual object ValidationValue => CustomValidationValue != null + public virtual object ValidationValue => CustomValidationValue is not null ? CustomValidationValue.Invoke() : InternalValue; /// /// Returns true if input belong to a . /// - protected bool ParentIsFieldBody => ParentFieldBody != null; + protected bool ParentIsFieldBody => ParentFieldBody is not null; /// /// Returns the default value for the type. diff --git a/Source/Blazorise/Base/BaseLinkComponent.cs b/Source/Blazorise/Base/BaseLinkComponent.cs index 57cde7b876..ba440f7fe6 100644 --- a/Source/Blazorise/Base/BaseLinkComponent.cs +++ b/Source/Blazorise/Base/BaseLinkComponent.cs @@ -45,10 +45,10 @@ protected override void OnParametersSet() PreventDefault = false; // in case the user has specified href instead of To we need to use that instead - if ( Attributes != null && Attributes.TryGetValue( "href", out var href ) ) + if ( Attributes is not null && Attributes.TryGetValue( "href", out var href ) ) To = $"{href}"; - if ( To != null && To.StartsWith( "#" ) ) + if ( To is not null && To.StartsWith( "#" ) ) { // If the href contains an anchor link we don't want the default click action to occur, but // rather take care of the click in our own method. @@ -76,7 +76,7 @@ protected override void Dispose( bool disposing ) if ( disposing ) { // To avoid leaking memory, it's important to detach any event handlers in Dispose() - if ( NavigationManager != null ) + if ( NavigationManager is not null ) { NavigationManager.LocationChanged -= OnLocationChanged; } @@ -146,7 +146,7 @@ private string GetAbsoluteUri( string relativeUri ) { try { - if ( relativeUri == null ) + if ( relativeUri is null ) return string.Empty; if ( relativeUri.StartsWith( "mailto:", StringComparison.OrdinalIgnoreCase ) ) diff --git a/Source/Blazorise/Base/BaseTextInput.razor.cs b/Source/Blazorise/Base/BaseTextInput.razor.cs index a7ce14ef1d..36f2296b81 100644 --- a/Source/Blazorise/Base/BaseTextInput.razor.cs +++ b/Source/Blazorise/Base/BaseTextInput.razor.cs @@ -63,7 +63,7 @@ protected override ValueTask DisposeAsync( bool disposing ) /// protected override void ReleaseResources() { - if ( inputValueDebouncer != null ) + if ( inputValueDebouncer is not null ) { inputValueDebouncer.Debounce -= OnInputValueDebounce; inputValueDebouncer = null; diff --git a/Source/Blazorise/Base/BaseValidationResult.cs b/Source/Blazorise/Base/BaseValidationResult.cs index 05e6460a9a..4f8fd42e67 100644 --- a/Source/Blazorise/Base/BaseValidationResult.cs +++ b/Source/Blazorise/Base/BaseValidationResult.cs @@ -59,7 +59,7 @@ protected override void OnParametersSet() private void DetachValidationStatusChangedListener() { - if ( previousParentValidation != null ) + if ( previousParentValidation is not null ) { previousParentValidation.ValidationStatusChanged -= OnValidationStatusChanged; } diff --git a/Source/Blazorise/ComponentActivator.cs b/Source/Blazorise/ComponentActivator.cs index bac8ee7cf8..b3703a5fdc 100644 --- a/Source/Blazorise/ComponentActivator.cs +++ b/Source/Blazorise/ComponentActivator.cs @@ -35,7 +35,7 @@ public IComponent CreateInstance( Type componentType ) { var instance = ServiceProvider.GetService( componentType ); - if ( instance == null ) + if ( instance is null ) { instance = Activator.CreateInstance( componentType ); } diff --git a/Source/Blazorise/Components/Addon/Addons.razor.cs b/Source/Blazorise/Components/Addon/Addons.razor.cs index 14867a78c8..cae1493c1d 100644 --- a/Source/Blazorise/Components/Addon/Addons.razor.cs +++ b/Source/Blazorise/Components/Addon/Addons.razor.cs @@ -28,7 +28,7 @@ protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed += OnThemeChanged; } @@ -52,7 +52,7 @@ protected override void Dispose( bool disposing ) { if ( disposing ) { - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed -= OnThemeChanged; } @@ -77,7 +77,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// A button reference that is placed inside of the addons. internal void NotifyButtonInitialized( Button button ) { - if ( button == null ) + if ( button is null ) return; registeredButtons ??= new(); @@ -94,10 +94,10 @@ internal void NotifyButtonInitialized( Button button ) /// A button reference that is placed inside of the addons. internal void NotifyButtonRemoved( Button button ) { - if ( button == null ) + if ( button is null ) return; - if ( registeredButtons != null && registeredButtons.Contains( button ) ) + if ( registeredButtons is not null && registeredButtons.Contains( button ) ) { registeredButtons.Remove( button ); } diff --git a/Source/Blazorise/Components/Badge/Badge.razor b/Source/Blazorise/Components/Badge/Badge.razor index 07ba265581..836ccbde84 100644 --- a/Source/Blazorise/Components/Badge/Badge.razor +++ b/Source/Blazorise/Components/Badge/Badge.razor @@ -1,6 +1,6 @@ @namespace Blazorise @inherits BaseComponent -@if ( Link != null ) +@if ( Link is not null ) { @ChildContent diff --git a/Source/Blazorise/Components/Bar/BarBrand.razor b/Source/Blazorise/Components/Bar/BarBrand.razor index fd37ebc46f..7abf111e8a 100644 --- a/Source/Blazorise/Components/Bar/BarBrand.razor +++ b/Source/Blazorise/Components/Bar/BarBrand.razor @@ -2,7 +2,7 @@ @inherits BaseComponent
@ChildContent - @if ( ParentBarState != null && ParentBarState.Mode != BarMode.Horizontal ) + @if ( ParentBarState is not null && ParentBarState.Mode != BarMode.Horizontal ) { Reference to the that is placed inside of this . internal void NotifyChildDropdownInitialized( BarDropdown barDropdown ) { - if ( childBarDropdown == null ) + if ( childBarDropdown is null ) childBarDropdown = barDropdown; } @@ -199,7 +199,7 @@ protected override void Dispose( bool disposing ) { if ( disposing ) { - if ( ParentBarDropdown != null ) + if ( ParentBarDropdown is not null ) { ParentBarDropdown.NotifyChildDropdownRemoved( this ); } @@ -233,12 +233,12 @@ protected override void Dispose( bool disposing ) /// /// Returns true if the BarDropdown is placed inside of another BarDropdown. /// - protected internal bool IsBarDropdownSubmenu => ParentBarDropdown != null; + protected internal bool IsBarDropdownSubmenu => ParentBarDropdown is not null; /// /// Returns true if this BarDropdown contains any child BarDropdown. /// - protected internal bool HasSubmenu => childBarDropdown != null; + protected internal bool HasSubmenu => childBarDropdown is not null; /// /// Gets the flag represented as a string. diff --git a/Source/Blazorise/Components/Bar/BarDropdownToggle.razor.cs b/Source/Blazorise/Components/Bar/BarDropdownToggle.razor.cs index f688bc37ff..df9805dc2f 100644 --- a/Source/Blazorise/Components/Bar/BarDropdownToggle.razor.cs +++ b/Source/Blazorise/Components/Bar/BarDropdownToggle.razor.cs @@ -99,7 +99,7 @@ protected async Task ClickHandler( MouseEventArgs eventArgs ) if ( IsDisabled ) return; - if ( ParentBarDropdown != null ) + if ( ParentBarDropdown is not null ) await ParentBarDropdown.Toggle( ElementId ); await Clicked.InvokeAsync( eventArgs ); @@ -115,7 +115,7 @@ protected Task KeyDownHandler( KeyboardEventArgs eventArgs ) if ( IsDisabled ) return Task.CompletedTask; - if ( ParentBarDropdown != null && eventArgs.Key == "Enter" ) + if ( ParentBarDropdown is not null && eventArgs.Key == "Enter" ) return ParentBarDropdown.Toggle( ElementId ); return Task.CompletedTask; @@ -130,7 +130,7 @@ public Task IsSafeToClose( string elementId, CloseReason closeReason, bool /// public Task Close( CloseReason closeReason ) { - if ( ParentBarDropdown != null ) + if ( ParentBarDropdown is not null ) return ParentBarDropdown.Hide(); return Task.CompletedTask; diff --git a/Source/Blazorise/Components/Bar/BarItem.razor.cs b/Source/Blazorise/Components/Bar/BarItem.razor.cs index ed9a6ea978..61971d4398 100644 --- a/Source/Blazorise/Components/Bar/BarItem.razor.cs +++ b/Source/Blazorise/Components/Bar/BarItem.razor.cs @@ -84,7 +84,7 @@ internal void NotifyBarDropdownInitialized( BarDropdown barDropdown ) /// /// True if component is placed inside of this . /// - protected bool HasDropdown => barDropdown != null; + protected bool HasDropdown => barDropdown is not null; /// /// Gets or sets the flag to indicate if is active, or focused. diff --git a/Source/Blazorise/Components/Bar/BarToggler.razor.cs b/Source/Blazorise/Components/Bar/BarToggler.razor.cs index 3efdd100b6..07ce4852c2 100644 --- a/Source/Blazorise/Components/Bar/BarToggler.razor.cs +++ b/Source/Blazorise/Components/Bar/BarToggler.razor.cs @@ -42,7 +42,7 @@ protected override Task OnInitializedAsync() protected override void BuildClasses( ClassBuilder builder ) { builder.Append( ClassProvider.BarToggler( ParentBarState?.Mode ?? BarMode.Horizontal, Mode ) ); - builder.Append( ClassProvider.BarTogglerCollapsed( ParentBarState?.Mode ?? BarMode.Horizontal, Mode, Bar != null ? Bar.Visible : ParentBarState.Visible ) ); + builder.Append( ClassProvider.BarTogglerCollapsed( ParentBarState?.Mode ?? BarMode.Horizontal, Mode, Bar is not null ? Bar.Visible : ParentBarState.Visible ) ); base.BuildClasses( builder ); } @@ -50,7 +50,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// protected override void BuildStyles( StyleBuilder builder ) { - if ( Bar != null ) + if ( Bar is not null ) { builder.Append( "display: inline-flex" ); } @@ -70,13 +70,13 @@ protected async Task ClickHandler( MouseEventArgs eventArgs ) await Clicked.InvokeAsync( eventArgs ); } - if ( Bar != null ) + if ( Bar is not null ) { await Bar.Toggle(); DirtyClasses(); } - else if ( ParentBar != null ) + else if ( ParentBar is not null ) { await ParentBar.Toggle(); } diff --git a/Source/Blazorise/Components/Breadcrumb/BreadcrumbItem.razor.cs b/Source/Blazorise/Components/Breadcrumb/BreadcrumbItem.razor.cs index 31a6690f97..ed2ec42737 100644 --- a/Source/Blazorise/Components/Breadcrumb/BreadcrumbItem.razor.cs +++ b/Source/Blazorise/Components/Breadcrumb/BreadcrumbItem.razor.cs @@ -89,7 +89,7 @@ protected virtual void OnLocationChanged( object sender, LocationChangedEventArg internal void NotifyRelativeUriChanged( string relativeUri ) { // uri will always be applied, no matter the BreadcrumbActivation state. - absoluteUri = relativeUri == null ? string.Empty : NavigationManager.ToAbsoluteUri( relativeUri ).AbsoluteUri; + absoluteUri = relativeUri is null ? string.Empty : NavigationManager.ToAbsoluteUri( relativeUri ).AbsoluteUri; } #endregion diff --git a/Source/Blazorise/Components/Button/Button.cs b/Source/Blazorise/Components/Button/Button.cs index 4b8b391ad8..d0744478c6 100644 --- a/Source/Blazorise/Components/Button/Button.cs +++ b/Source/Blazorise/Components/Button/Button.cs @@ -55,7 +55,7 @@ protected override void BuildClasses( ClassBuilder builder ) builder.Append( ClassProvider.ButtonBlock( Outline ), Block ); builder.Append( ClassProvider.ButtonActive( Outline ), Active ); builder.Append( ClassProvider.ButtonDisabled( Outline ), Disabled ); - builder.Append( ClassProvider.ButtonLoading( Outline ), Loading && LoadingTemplate == null ); + builder.Append( ClassProvider.ButtonLoading( Outline ), Loading && LoadingTemplate is null ); base.BuildClasses( builder ); } @@ -79,7 +79,7 @@ protected override void OnInitialized() LoadingTemplate ??= ProvideDefaultLoadingTemplate(); - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed += OnThemeChanged; } @@ -107,12 +107,12 @@ protected override async ValueTask DisposeAsync( bool disposing ) await JSModule.SafeDestroy( ElementRef, ElementId ); } - if ( command != null ) + if ( command is not null ) { command.CanExecuteChanged -= OnCanExecuteChanged; } - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed -= OnThemeChanged; } @@ -176,12 +176,12 @@ protected override void BuildRenderTree( RenderTreeBuilder builder ) } builder.OnClick( this, EventCallback.Factory.Create( this, ClickHandler ) ); - builder.OnClickPreventDefault( Type == ButtonType.Link && To != null && To.StartsWith( "#" ) ); + builder.OnClickPreventDefault( Type == ButtonType.Link && To is not null && To.StartsWith( "#" ) ); builder.Attributes( Attributes ); builder.ElementReferenceCapture( capturedRef => ElementRef = capturedRef ); - if ( Loading && LoadingTemplate != null ) + if ( Loading && LoadingTemplate is not null ) { builder.Content( LoadingTemplate ); } @@ -197,14 +197,14 @@ protected override void BuildRenderTree( RenderTreeBuilder builder ) private void BindCommand( ICommand value ) { - if ( command != null ) + if ( command is not null ) { command.CanExecuteChanged -= OnCanExecuteChanged; } command = value; - if ( command != null ) + if ( command is not null ) { command.CanExecuteChanged += OnCanExecuteChanged; } @@ -269,7 +269,7 @@ private void OnThemeChanged( object sender, EventArgs eventArgs ) /// /// True if button is placed inside of a . /// - protected bool ParentIsField => ParentField != null; + protected bool ParentIsField => ParentField is not null; /// /// Gets the size based on the theme settings. diff --git a/Source/Blazorise/Components/Button/CloseButton.razor.cs b/Source/Blazorise/Components/Button/CloseButton.razor.cs index def1af9c91..59ed23f348 100644 --- a/Source/Blazorise/Components/Button/CloseButton.razor.cs +++ b/Source/Blazorise/Components/Button/CloseButton.razor.cs @@ -38,11 +38,11 @@ protected async Task ClickHandler( MouseEventArgs eventArgs ) // And we don't want to close both Alert and Modal in that case. if ( IsAutoClose ) { - if ( ParentAlert != null ) + if ( ParentAlert is not null ) { await ParentAlert.Hide(); } - else if ( ParentModal != null ) + else if ( ParentModal is not null ) { await ParentModal.Hide(); } diff --git a/Source/Blazorise/Components/Card/Card.razor.cs b/Source/Blazorise/Components/Card/Card.razor.cs index 1f965b3206..eddb03ed11 100644 --- a/Source/Blazorise/Components/Card/Card.razor.cs +++ b/Source/Blazorise/Components/Card/Card.razor.cs @@ -35,7 +35,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// /// True if card is placed inside of a deck. /// - protected bool InsideDeck => ParentCardDeck != null; + protected bool InsideDeck => ParentCardDeck is not null; /// /// Sets the white text when using the darker background. diff --git a/Source/Blazorise/Components/Card/CardSubtitle.razor.cs b/Source/Blazorise/Components/Card/CardSubtitle.razor.cs index 7d272dbeeb..3f0a4c46de 100644 --- a/Source/Blazorise/Components/Card/CardSubtitle.razor.cs +++ b/Source/Blazorise/Components/Card/CardSubtitle.razor.cs @@ -34,7 +34,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// /// Indicates if the subtitle is placed inside if card header. /// - protected bool InsideHeader => ParentCardHeader != null; + protected bool InsideHeader => ParentCardHeader is not null; /// /// Number from 1 to 6 that defines the subtitle size where the smaller number means larger text. diff --git a/Source/Blazorise/Components/Card/CardTitle.razor b/Source/Blazorise/Components/Card/CardTitle.razor index 0f2ba63396..525ddc6905 100644 --- a/Source/Blazorise/Components/Card/CardTitle.razor +++ b/Source/Blazorise/Components/Card/CardTitle.razor @@ -1,6 +1,6 @@ @namespace Blazorise @inherits BaseTypographyComponent -@if ( Size != null ) +@if ( Size is not null ) { @ChildContent diff --git a/Source/Blazorise/Components/Card/CardTitle.razor.cs b/Source/Blazorise/Components/Card/CardTitle.razor.cs index f73e424e68..a7597be98f 100644 --- a/Source/Blazorise/Components/Card/CardTitle.razor.cs +++ b/Source/Blazorise/Components/Card/CardTitle.razor.cs @@ -34,7 +34,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// /// Indicates if the title is placed inside if card header. /// - protected bool InsideHeader => ParentCardHeader != null; + protected bool InsideHeader => ParentCardHeader is not null; /// /// Number from 1 to 6 that defines the title size where the smaller number means larger text. diff --git a/Source/Blazorise/Components/Carousel/Carousel.razor.cs b/Source/Blazorise/Components/Carousel/Carousel.razor.cs index 6b6a1d969a..e370c424f4 100644 --- a/Source/Blazorise/Components/Carousel/Carousel.razor.cs +++ b/Source/Blazorise/Components/Carousel/Carousel.razor.cs @@ -74,7 +74,7 @@ protected override void OnInitialized() { SetTimer(); - if ( TransitionTimer == null ) + if ( TransitionTimer is null ) { InitializeTransitionTimer(); } @@ -304,7 +304,7 @@ private void SetTimer() { TimerEnabled = ( Interval > 0 ); - if ( Timer == null && TimerEnabled ) + if ( Timer is null && TimerEnabled ) { InitializeTimer(); } @@ -317,7 +317,7 @@ private void SetTimer() private void ResetTimer() { - if ( Timer != null ) + if ( Timer is not null ) { Timer.Stop(); @@ -333,7 +333,7 @@ private void ResetTimer() private void ResetTransitionTimer() { - if ( TransitionTimer != null ) + if ( TransitionTimer is not null ) { TransitionTimer.Stop(); // Avoid an System.ObjectDisposedException due to the timer being disposed. This occurs when the Enabled property of the timer is set to false by the call to Stop() above. @@ -588,7 +588,7 @@ protected string PreviousButtonString { var localizationString = "Previous"; - if ( PreviousButtonLocalizer != null ) + if ( PreviousButtonLocalizer is not null ) return PreviousButtonLocalizer.Invoke( localizationString ); return Localizer[localizationString]; @@ -604,7 +604,7 @@ protected string NextButtonString { var localizationString = "Next"; - if ( PreviousButtonLocalizer != null ) + if ( PreviousButtonLocalizer is not null ) return PreviousButtonLocalizer.Invoke( localizationString ); return Localizer[localizationString]; diff --git a/Source/Blazorise/Components/Carousel/CarouselSlide.razor.cs b/Source/Blazorise/Components/Carousel/CarouselSlide.razor.cs index 31ac269469..b834d51849 100644 --- a/Source/Blazorise/Components/Carousel/CarouselSlide.razor.cs +++ b/Source/Blazorise/Components/Carousel/CarouselSlide.razor.cs @@ -45,7 +45,7 @@ public CarouselSlide() /// protected override void OnInitialized() { - if ( ParentCarousel != null ) + if ( ParentCarousel is not null ) { ParentCarousel.AddSlide( this ); diff --git a/Source/Blazorise/Components/Check/Check.razor.cs b/Source/Blazorise/Components/Check/Check.razor.cs index 79327ef8fe..f67d43613f 100644 --- a/Source/Blazorise/Components/Check/Check.razor.cs +++ b/Source/Blazorise/Components/Check/Check.razor.cs @@ -36,7 +36,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( CheckedExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); diff --git a/Source/Blazorise/Components/Collapse/Collapse.razor.cs b/Source/Blazorise/Components/Collapse/Collapse.razor.cs index b2e2eda2e9..a8fb8ecd96 100644 --- a/Source/Blazorise/Components/Collapse/Collapse.razor.cs +++ b/Source/Blazorise/Components/Collapse/Collapse.razor.cs @@ -84,7 +84,7 @@ private void RaiseEvents( bool visible ) /// /// Determines if the collapse is placed inside of accordion component. /// - public bool InsideAccordion => ParentAccordion != null; + public bool InsideAccordion => ParentAccordion is not null; /// /// Determines if the collapse is placed inside of accordion component as the first item. diff --git a/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs b/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs index 11fa6fd23f..63fc6ab6c1 100644 --- a/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs +++ b/Source/Blazorise/Components/Collapse/CollapseHeader.razor.cs @@ -33,7 +33,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// A task that represents the asynchronous operation. protected async Task ClickHandler( MouseEventArgs eventArgs ) { - if ( ParentCollapse != null ) + if ( ParentCollapse is not null ) await ParentCollapse.Toggle(); await Clicked.InvokeAsync( eventArgs ); diff --git a/Source/Blazorise/Components/ColorEdit/ColorEdit.razor.cs b/Source/Blazorise/Components/ColorEdit/ColorEdit.razor.cs index a9adc5dd38..0c2c223ae8 100644 --- a/Source/Blazorise/Components/ColorEdit/ColorEdit.razor.cs +++ b/Source/Blazorise/Components/ColorEdit/ColorEdit.razor.cs @@ -33,7 +33,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( ColorExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); diff --git a/Source/Blazorise/Components/ColorPicker/ColorPicker.razor.cs b/Source/Blazorise/Components/ColorPicker/ColorPicker.razor.cs index 568b9add83..fb70d996a1 100644 --- a/Source/Blazorise/Components/ColorPicker/ColorPicker.razor.cs +++ b/Source/Blazorise/Components/ColorPicker/ColorPicker.razor.cs @@ -69,7 +69,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( ColorExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); @@ -94,7 +94,7 @@ protected override void OnInitialized() private async void OnLocalizationChanged( object sender, EventArgs eventArgs ) { // no need to refresh if we're using custom localization - if ( PickerLocalizer != null ) + if ( PickerLocalizer is not null ) return; ExecuteAfterRender( async () => await JSModule.UpdateLocalization( ElementRef, ElementId, Localizer.GetStrings() ) ); diff --git a/Source/Blazorise/Components/DateEdit/DateEdit.razor.cs b/Source/Blazorise/Components/DateEdit/DateEdit.razor.cs index a2194bdad7..f8ea5fe8bf 100644 --- a/Source/Blazorise/Components/DateEdit/DateEdit.razor.cs +++ b/Source/Blazorise/Components/DateEdit/DateEdit.razor.cs @@ -31,7 +31,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( DateExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); diff --git a/Source/Blazorise/Components/DatePicker/DatePicker.razor.cs b/Source/Blazorise/Components/DatePicker/DatePicker.razor.cs index 47df024919..13704ebaed 100644 --- a/Source/Blazorise/Components/DatePicker/DatePicker.razor.cs +++ b/Source/Blazorise/Components/DatePicker/DatePicker.razor.cs @@ -104,7 +104,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) // Let blazor do its thing! await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( DateExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); @@ -221,13 +221,13 @@ protected override Task OnInternalValueChanged( IReadOnlyList value ) if ( SelectionMode != DateInputSelectionMode.Single ) return DatesChanged.InvokeAsync( value ); else - return DateChanged.InvokeAsync( value == null ? default : value.FirstOrDefault() ); + return DateChanged.InvokeAsync( value is null ? default : value.FirstOrDefault() ); } /// protected override string FormatValueAsString( IReadOnlyList values ) { - if ( values == null || values.Count == 0 ) + if ( values is null || values.Count == 0 ) return null; if ( SelectionMode != DateInputSelectionMode.Single ) @@ -243,7 +243,7 @@ protected override string FormatValueAsString( IReadOnlyList values ) } else { - if ( values[0] == null ) + if ( values[0] is null ) return null; return Formaters.FormatDateValueAsString( values[0], DateFormat ); @@ -476,7 +476,7 @@ protected override IReadOnlyList InternalValue } else { - Date = value == null ? default : value.FirstOrDefault(); + Date = value is null ? default : value.FirstOrDefault(); } } } diff --git a/Source/Blazorise/Components/Divider/Divider.razor.cs b/Source/Blazorise/Components/Divider/Divider.razor.cs index f8478a0f90..79c6796cbf 100644 --- a/Source/Blazorise/Components/Divider/Divider.razor.cs +++ b/Source/Blazorise/Components/Divider/Divider.razor.cs @@ -26,7 +26,7 @@ public partial class Divider : BaseComponent, IDisposable /// protected override void OnInitialized() { - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed += OnThemeChanged; } @@ -39,7 +39,7 @@ protected override void Dispose( bool disposing ) { if ( disposing ) { - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed -= OnThemeChanged; } diff --git a/Source/Blazorise/Components/Dropdown/Dropdown.razor.cs b/Source/Blazorise/Components/Dropdown/Dropdown.razor.cs index 1749120581..b5b271a9a5 100644 --- a/Source/Blazorise/Components/Dropdown/Dropdown.razor.cs +++ b/Source/Blazorise/Components/Dropdown/Dropdown.razor.cs @@ -53,7 +53,7 @@ public partial class Dropdown : BaseComponent, IAsyncDisposable /// protected override void OnInitialized() { - if ( ParentDropdown != null ) + if ( ParentDropdown is not null ) { ParentDropdown.NotifyChildDropdownInitialized( this ); } @@ -126,7 +126,7 @@ protected override async ValueTask DisposeAsync( bool disposing ) { if ( disposing ) { - if ( ParentDropdown != null ) + if ( ParentDropdown is not null ) { ParentDropdown.NotifyChildDropdownRemoved( this ); } @@ -245,7 +245,7 @@ internal void SetSelectedDropdownElementId( string dropdownToggleElementId ) /// Reference to the that is placed inside of this . internal protected void NotifyButtonInitialized( Button button ) { - if ( button == null ) + if ( button is null ) return; childrenButtonList ??= new(); @@ -262,10 +262,10 @@ internal protected void NotifyButtonInitialized( Button button ) /// Reference to the that is placed inside of this . internal protected void NotifyButtonRemoved( Button button ) { - if ( button == null ) + if ( button is null ) return; - if ( childrenButtonList != null && childrenButtonList.Contains( button ) ) + if ( childrenButtonList is not null && childrenButtonList.Contains( button ) ) { childrenButtonList.Remove( button ); } @@ -277,7 +277,7 @@ internal protected void NotifyButtonRemoved( Button button ) /// Reference to the that is placed inside of this . internal protected void NotifyChildDropdownInitialized( Dropdown dropdown ) { - if ( childDropdown == null ) + if ( childDropdown is null ) childDropdown = dropdown; } @@ -296,7 +296,7 @@ internal protected void NotifyChildDropdownRemoved( Dropdown dropdown ) /// Reference to the that is placed inside of this . internal protected void NotifyDropdownMenuInitialized( DropdownMenu dropdownMenu ) { - if ( dropdownMenu == null ) + if ( dropdownMenu is null ) return; childrenDropdownMenus ??= new(); @@ -316,7 +316,7 @@ internal protected bool NotifyDropdownMenuRemoved( DropdownMenu dropdownMenu ) /// Reference to the that is placed inside of this . internal protected void NotifyDropdownToggleInitialized( DropdownToggle dropdownToggle ) { - if ( dropdownToggle == null ) + if ( dropdownToggle is null ) return; childrenDropdownToggles ??= new(); @@ -382,17 +382,17 @@ private void HandleVisibilityEvents( bool visible ) /// /// Makes the drop down to behave as a group for buttons(used for the split-button behaviour). /// - protected internal bool IsGroup => ParentButtons != null || childrenButtonList?.Count >= 1; + protected internal bool IsGroup => ParentButtons is not null || childrenButtonList?.Count >= 1; /// /// Returns true if the dropdown is placed inside of another dropdown. /// - protected internal bool IsDropdownSubmenu => ParentDropdown != null; + protected internal bool IsDropdownSubmenu => ParentDropdown is not null; /// /// Returns true if this dropdown contains any child dropdown. /// - protected internal bool HasSubmenu => childDropdown != null; + protected internal bool HasSubmenu => childDropdown is not null; /// /// Tracks the last DropdownToggle Element Id that acted. diff --git a/Source/Blazorise/Components/Dropdown/DropdownMenu.razor.cs b/Source/Blazorise/Components/Dropdown/DropdownMenu.razor.cs index b1e4de7d15..c0cedefc09 100644 --- a/Source/Blazorise/Components/Dropdown/DropdownMenu.razor.cs +++ b/Source/Blazorise/Components/Dropdown/DropdownMenu.razor.cs @@ -51,7 +51,7 @@ protected override void Dispose( bool disposing ) protected override void BuildClasses( ClassBuilder builder ) { builder.Append( ClassProvider.DropdownMenu() ); - builder.Append( ClassProvider.DropdownMenuScrollable(), MaxMenuHeight != null ); + builder.Append( ClassProvider.DropdownMenuScrollable(), MaxMenuHeight is not null ); builder.Append( ClassProvider.DropdownMenuVisible( ParentDropdownState.Visible ) ); builder.Append( ClassProvider.DropdownMenuRight(), ParentDropdownState.RightAligned ); builder.Append( ClassProvider.DropdownMenuPositionStrategy( ParentDropdown.PositionStrategy ) ); @@ -62,7 +62,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// protected override void BuildStyles( StyleBuilder builder ) { - if ( MaxMenuHeight != null ) + if ( MaxMenuHeight is not null ) builder.Append( $"--dropdown-list-menu-max-height: {MaxMenuHeight};" ); base.BuildStyles( builder ); diff --git a/Source/Blazorise/Components/Dropdown/DropdownToggle.razor.cs b/Source/Blazorise/Components/Dropdown/DropdownToggle.razor.cs index d578fe7758..5144a002ba 100644 --- a/Source/Blazorise/Components/Dropdown/DropdownToggle.razor.cs +++ b/Source/Blazorise/Components/Dropdown/DropdownToggle.razor.cs @@ -40,7 +40,7 @@ protected override void OnInitialized() ParentDropdown.NotifyDropdownToggleInitialized( this ); } - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed += OnThemeChanged; } @@ -103,7 +103,7 @@ protected override async ValueTask DisposeAsync( bool disposing ) ParentDropdown.NotifyDropdownToggleRemoved( this ); } - if ( Theme != null ) + if ( Theme is not null ) { Theme.Changed -= OnThemeChanged; } @@ -122,7 +122,7 @@ protected async Task ClickHandler( MouseEventArgs eventArgs ) if ( Disabled ) return; - if ( ParentDropdown != null ) + if ( ParentDropdown is not null ) await ParentDropdown.Toggle( ElementId ); await Clicked.InvokeAsync( eventArgs ); @@ -150,7 +150,7 @@ public Task IsSafeToClose( string elementId, CloseReason closeReason, bool /// Returns the awaitable task. public Task Close( CloseReason closeReason ) { - if ( ParentDropdown != null ) + if ( ParentDropdown is not null ) return ParentDropdown.Hide(); return Task.CompletedTask; diff --git a/Source/Blazorise/Components/Droppable/DraggableTransaction.cs b/Source/Blazorise/Components/Droppable/DraggableTransaction.cs index 881fe9fa52..2ba54e0d1f 100644 --- a/Source/Blazorise/Components/Droppable/DraggableTransaction.cs +++ b/Source/Blazorise/Components/Droppable/DraggableTransaction.cs @@ -51,7 +51,7 @@ public DraggableTransaction( TItem item, string sourceZoneName, int index, Func< /// A task that represents the asynchronous operation. public Task Cancel() { - if ( Canceled != null ) + if ( Canceled is not null ) return Canceled.Invoke(); return Task.CompletedTask; @@ -63,7 +63,7 @@ public Task Cancel() /// A task that represents the asynchronous operation. public Task Commit() { - if ( Commited != null ) + if ( Commited is not null ) return Commited.Invoke(); return Task.CompletedTask; diff --git a/Source/Blazorise/Components/Droppable/DropContainer.razor.cs b/Source/Blazorise/Components/Droppable/DropContainer.razor.cs index ae0fc7659e..9e2a37e97e 100644 --- a/Source/Blazorise/Components/Droppable/DropContainer.razor.cs +++ b/Source/Blazorise/Components/Droppable/DropContainer.razor.cs @@ -174,7 +174,7 @@ public bool HasTransactionIndexChanged { get { - if ( transaction == null ) + if ( transaction is null ) return false; return transaction.CurrentZoneName != transaction.SourceZoneName || transaction.Index != transaction.SourceIndex; @@ -189,7 +189,7 @@ public bool HasTransactionIndexChanged /// True if the zone and index matches the current transaction. public bool IsOrigin( int index, string zoneName ) { - if ( transaction == null ) + if ( transaction is null ) { return false; } @@ -224,7 +224,7 @@ public bool IsTransactionOriginatedFromInside( string zoneName ) /// True if the drag transaction is in process. /// public bool TransactionInProgress - => transaction != null; + => transaction is not null; /// /// Gets the name of the dropzone that started the transaction. diff --git a/Source/Blazorise/Components/Droppable/DropZone.razor b/Source/Blazorise/Components/Droppable/DropZone.razor index c3e7ef6d7e..785e287dcb 100644 --- a/Source/Blazorise/Components/Droppable/DropZone.razor +++ b/Source/Blazorise/Components/Droppable/DropZone.razor @@ -54,7 +54,7 @@ var renderer = ItemTemplate ?? ParentContainer?.ItemTemplate; } - @if ( renderer != null ) + @if ( renderer is not null ) { @renderer(item) } diff --git a/Source/Blazorise/Components/Droppable/DropZone.razor.cs b/Source/Blazorise/Components/Droppable/DropZone.razor.cs index 130c13440e..1ca11b6449 100644 --- a/Source/Blazorise/Components/Droppable/DropZone.razor.cs +++ b/Source/Blazorise/Components/Droppable/DropZone.razor.cs @@ -58,7 +58,7 @@ public DropZone() /// protected override void OnInitialized() { - if ( ParentContainer != null ) + if ( ParentContainer is not null ) { ParentContainer.TransactionStarted += OnContainerTransactionStarted; ParentContainer.TransactionEnded += OnContainerTransactionEnded; @@ -122,7 +122,7 @@ protected override async ValueTask DisposeAsync( bool disposing ) await JSModule.SafeDestroy( ElementRef, ElementId ); } - if ( ParentContainer != null ) + if ( ParentContainer is not null ) { ParentContainer.TransactionStarted -= OnContainerTransactionStarted; ParentContainer.TransactionEnded -= OnContainerTransactionEnded; @@ -212,7 +212,7 @@ private void OnDragEnterHandler() var (context, canBeDropped) = ItemCanBeDropped(); - if ( context == null ) + if ( context is null ) { return; } @@ -230,7 +230,7 @@ private void OnDragLeaveHandler() var (context, _) = ItemCanBeDropped(); - if ( context == null ) + if ( context is null ) { return; } @@ -242,7 +242,7 @@ private async Task OnDropHandler() { var (context, canBeDropped) = ItemCanBeDropped(); - if ( context == null ) + if ( context is null ) { return; } @@ -310,21 +310,21 @@ private async Task OnDropHandler() private (TItem, bool) ItemCanBeDropped() { - if ( ParentContainer == null || ParentContainer.TransactionInProgress == false ) + if ( ParentContainer is null || ParentContainer.TransactionInProgress == false ) return (default( TItem ), false); var item = ParentContainer.GetTransactionItem(); - if ( item == null ) + if ( item is null ) return (default( TItem ), false); var canBeDropped = true; - if ( DropAllowed != null ) + if ( DropAllowed is not null ) { canBeDropped = DropAllowed( item ); } - else if ( ParentContainer.DropAllowed != null ) + else if ( ParentContainer.DropAllowed is not null ) { canBeDropped = ParentContainer.DropAllowed( item, Name ); } @@ -354,7 +354,7 @@ private IEnumerable GetItems() Func predicate = ( item ) => ParentContainer.ItemsFilter( item, Name ?? string.Empty ); - if ( ItemsFilter != null ) + if ( ItemsFilter is not null ) { predicate = ItemsFilter; } @@ -371,7 +371,7 @@ private bool GetItemDisabled( TItem item ) var predicate = ItemDisabled ?? ParentContainer?.ItemDisabled; - if ( predicate != null ) + if ( predicate is not null ) { disabled = predicate( item ); } diff --git a/Source/Blazorise/Components/Droppable/_Draggable.razor.cs b/Source/Blazorise/Components/Droppable/_Draggable.razor.cs index c33c66588e..5a60d234f6 100644 --- a/Source/Blazorise/Components/Droppable/_Draggable.razor.cs +++ b/Source/Blazorise/Components/Droppable/_Draggable.razor.cs @@ -36,7 +36,7 @@ protected override void BuildClasses( ClassBuilder builder ) private async Task OnDragStartHandler() { - if ( ParentContainer == null ) + if ( ParentContainer is null ) return; dragging = true; @@ -64,7 +64,7 @@ private async Task OnDragEndHandler( DragEventArgs e ) private void OnDragEnterHandler() { - if ( ParentContainer == null || ParentContainer.TransactionInProgress == false ) + if ( ParentContainer is null || ParentContainer.TransactionInProgress == false ) return; ParentContainer.UpdateTransactionIndex( Index ); diff --git a/Source/Blazorise/Components/Field/Field.razor.cs b/Source/Blazorise/Components/Field/Field.razor.cs index c13ff8a897..f296dad3a0 100644 --- a/Source/Blazorise/Components/Field/Field.razor.cs +++ b/Source/Blazorise/Components/Field/Field.razor.cs @@ -69,7 +69,7 @@ protected override void Dispose( bool disposing ) /// private void DetachValidationStatusChangedListener() { - if ( previousParentValidation != null ) + if ( previousParentValidation is not null ) { previousParentValidation.ValidationStatusChanged -= OnValidationStatusChanged; } @@ -81,7 +81,7 @@ protected override void BuildClasses( ClassBuilder builder ) builder.Append( ClassProvider.Field() ); builder.Append( ClassProvider.FieldHorizontal(), Horizontal ); builder.Append( ClassProvider.FieldJustifyContent( JustifyContent ), JustifyContent != JustifyContent.Default ); - builder.Append( ClassProvider.FieldValidation( ParentValidation?.Status ?? ValidationStatus.None ), ParentValidation != null ); + builder.Append( ClassProvider.FieldValidation( ParentValidation?.Status ?? ValidationStatus.None ), ParentValidation is not null ); base.BuildClasses( builder ); } @@ -126,7 +126,7 @@ internal void UnHook( BaseComponent component ) /// /// Determines if the field is inside of component. /// - protected bool IsFields => ParentFields != null; + protected bool IsFields => ParentFields is not null; /// /// Aligns the controls for horizontal form. diff --git a/Source/Blazorise/Components/Field/FieldHelp.razor.cs b/Source/Blazorise/Components/Field/FieldHelp.razor.cs index a17edf5210..f62d452849 100644 --- a/Source/Blazorise/Components/Field/FieldHelp.razor.cs +++ b/Source/Blazorise/Components/Field/FieldHelp.razor.cs @@ -27,7 +27,7 @@ protected override void BuildClasses( ClassBuilder builder ) /// /// True if the parent is in horizontal mode. /// - protected virtual bool ParentIsFieldBody => ParentFieldBody != null; + protected virtual bool ParentIsFieldBody => ParentFieldBody is not null; /// /// Specifies the content to be rendered inside this . diff --git a/Source/Blazorise/Components/Field/Fields.razor b/Source/Blazorise/Components/Field/Fields.razor index be92335ba4..ba8c843bdb 100644 --- a/Source/Blazorise/Components/Field/Fields.razor +++ b/Source/Blazorise/Components/Field/Fields.razor @@ -1,14 +1,14 @@ @namespace Blazorise @inherits BaseColumnComponent - @if ( Label != null ) + @if ( Label is not null ) { }
@ChildContent
- @if ( Help != null ) + @if ( Help is not null ) { @Help } diff --git a/Source/Blazorise/Components/Field/Fields.razor.cs b/Source/Blazorise/Components/Field/Fields.razor.cs index 64bb6e9b94..552f9b41ee 100644 --- a/Source/Blazorise/Components/Field/Fields.razor.cs +++ b/Source/Blazorise/Components/Field/Fields.razor.cs @@ -27,7 +27,7 @@ protected override void BuildClasses( ClassBuilder builder ) { builder.Append( ClassProvider.Fields() ); - if ( ColumnSize != null ) + if ( ColumnSize is not null ) { builder.Append( ClassProvider.FieldsColumn() ); } diff --git a/Source/Blazorise/Components/FileEdit/FileEdit.razor.cs b/Source/Blazorise/Components/FileEdit/FileEdit.razor.cs index d8643f4aac..30de8e1ee9 100644 --- a/Source/Blazorise/Components/FileEdit/FileEdit.razor.cs +++ b/Source/Blazorise/Components/FileEdit/FileEdit.razor.cs @@ -50,7 +50,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) { await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { await InitializeValidation(); } @@ -72,7 +72,7 @@ protected override void OnInitialized() private async void OnLocalizationChanged( object sender, EventArgs eventArgs ) { // no need to refresh if we're using custom localization - if ( BrowseButtonLocalizer != null ) + if ( BrowseButtonLocalizer is not null ) return; await InvokeAsync( StateHasChanged ); @@ -144,7 +144,7 @@ public async Task NotifyChange( FileEntry[] files ) InternalValue = updatedFiles.ToArray(); // send the value to the validation for processing - if ( ParentValidation != null ) + if ( ParentValidation is not null ) await ParentValidation.NotifyInputChanged( files ); await Changed.InvokeAsync( new( files ) ); @@ -326,7 +326,7 @@ protected string BrowseButtonString ? $"Choose {uploadTypeString}s" : $"Choose {uploadTypeString}"; - if ( BrowseButtonLocalizer != null ) + if ( BrowseButtonLocalizer is not null ) return BrowseButtonLocalizer.Invoke( localizationString ); return Localizer[localizationString]; diff --git a/Source/Blazorise/Components/Icon/Icon.razor b/Source/Blazorise/Components/Icon/Icon.razor index e446d000c1..bd00773af4 100644 --- a/Source/Blazorise/Components/Icon/Icon.razor +++ b/Source/Blazorise/Components/Icon/Icon.razor @@ -1,7 +1,7 @@ @namespace Blazorise @inherits BaseComponent - @if ( IconProvider.IconNameAsContent && Name != null ) + @if ( IconProvider.IconNameAsContent && Name is not null ) { if ( Name is IconName ) { diff --git a/Source/Blazorise/Components/InputMask/InputMask.razor.cs b/Source/Blazorise/Components/InputMask/InputMask.razor.cs index ef09fac2a8..f0c66a7010 100644 --- a/Source/Blazorise/Components/InputMask/InputMask.razor.cs +++ b/Source/Blazorise/Components/InputMask/InputMask.razor.cs @@ -40,7 +40,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( ValueExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); diff --git a/Source/Blazorise/Components/Layout/Layout.razor b/Source/Blazorise/Components/Layout/Layout.razor index 84645f58f1..754dd05081 100644 --- a/Source/Blazorise/Components/Layout/Layout.razor +++ b/Source/Blazorise/Components/Layout/Layout.razor @@ -4,7 +4,7 @@
@if ( Loading ) { - @if ( LoadingTemplate != null ) + @if ( LoadingTemplate is not null ) { @LoadingTemplate } diff --git a/Source/Blazorise/Components/Layout/Layout.razor.cs b/Source/Blazorise/Components/Layout/Layout.razor.cs index 8c695b094e..3f24069141 100644 --- a/Source/Blazorise/Components/Layout/Layout.razor.cs +++ b/Source/Blazorise/Components/Layout/Layout.razor.cs @@ -39,7 +39,7 @@ protected override void BuildClasses( ClassBuilder builder ) { builder.Append( ClassProvider.Layout() ); builder.Append( ClassProvider.LayoutHasSider(), Sider ); - builder.Append( ClassProvider.LayoutRoot(), ParentLayout == null ); + builder.Append( ClassProvider.LayoutRoot(), ParentLayout is null ); base.BuildClasses( builder ); } diff --git a/Source/Blazorise/Components/ListGroup/ListGroupItem.razor.cs b/Source/Blazorise/Components/ListGroup/ListGroupItem.razor.cs index 7218e637a5..f5815a387b 100644 --- a/Source/Blazorise/Components/ListGroup/ListGroupItem.razor.cs +++ b/Source/Blazorise/Components/ListGroup/ListGroupItem.razor.cs @@ -56,7 +56,7 @@ protected async Task ClickHandler( MouseEventArgs eventArgs ) if ( Disabled ) return; - if ( ParentListGroup != null ) + if ( ParentListGroup is not null ) await ParentListGroup.SelectItem( Name ); await Clicked.InvokeAsync( eventArgs ); diff --git a/Source/Blazorise/Components/MemoEdit/MemoEdit.razor.cs b/Source/Blazorise/Components/MemoEdit/MemoEdit.razor.cs index f0f69471bc..ac891d9961 100644 --- a/Source/Blazorise/Components/MemoEdit/MemoEdit.razor.cs +++ b/Source/Blazorise/Components/MemoEdit/MemoEdit.razor.cs @@ -64,7 +64,7 @@ public override async Task SetParametersAsync( ParameterView parameters ) await base.SetParametersAsync( parameters ); - if ( ParentValidation != null ) + if ( ParentValidation is not null ) { if ( parameters.TryGetValue>>( nameof( TextExpression ), out var expression ) ) await ParentValidation.InitializeInputExpression( expression ); diff --git a/Source/Blazorise/Components/MessageAlert/MessageAlert.razor b/Source/Blazorise/Components/MessageAlert/MessageAlert.razor index 8ba1a8f239..3b398a0a59 100644 --- a/Source/Blazorise/Components/MessageAlert/MessageAlert.razor +++ b/Source/Blazorise/Components/MessageAlert/MessageAlert.razor @@ -26,14 +26,14 @@ @if ( IsConfirmation ) {