Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

blazor ref to component in if

<button OnClick="Show">Show bla bla bla</button>

@if (IsVisible)
{
  <div @ref="MyRef">Bla bla bla</div>
}

@code {
  private bool IsVisible = false;
  ElementReference MyRef;
  
  public async Task Show()
  {
    IsVisible = true;
    
    // Wait for the Renderer service empty it's queue
    // or in another words: 
    // wait for the non rendered element to apply its reference
    StateHasChanged();
    await Task.Yield();
    
    var anotherRef = MyRef;
  }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: linq when name then orderby 
Csharp :: how to destroy parent gameobject unity 
Csharp :: c# numbers only 
Csharp :: unity gui style color button 
Csharp :: input unity 
Csharp :: c# loops 
Csharp :: c# how to crete array 
Csharp :: quotes in string f# 
Csharp :: How to type custom backcolor on c# winform 
Csharp :: what is void onmousedown() 
Csharp :: string tochararray c# 
Csharp :: unity game object remove parent 
Csharp :: make 2D object move at constant speed unity 
Csharp :: mongodb c# batch find 
Csharp :: vb.net read text file line by line 
Csharp :: c# foreach namevaluecollection 
Csharp :: wpf how to focus on element 
Csharp :: get enum value c# 
Csharp :: get domain name from email in asp.net c# 
Csharp :: iterate though data in firebase unity 
Csharp :: unity scroll rect to bottom 
Csharp :: sum the digits in c# 
Csharp :: class in c# 
Csharp :: how to create url parameters for URi C# 
Csharp :: viewBag as a list 
Csharp :: mvc c# return renderPartial 
Csharp :: select range in list c# 
Csharp :: unity c# find object position in array 
Csharp :: render world space UI infront of everything unity 
Csharp :: clickable table row asp.net core 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =