You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It could greatly simplify the use of the offcanvas if rather than needing a reference to it so one can call ShowAsync() and HideAsync(), if it an "IsVisible" property that could be bound. Behind the scenes, in the setter, it could call Show/Hide.
privatebool_isVisible;[Parameter]publicboolIsVisible{get=> _isVisible;set{if(value==_isVisible){return;}_isVisible=value;if(value){ShowAsync();}else{HideAsync();}}}publicTaskShowAsync(){_isVisible=true;//rest of code}publicTaskHideAsync(){_isVisible=false;//rest of code}
The text was updated successfully, but these errors were encountered:
Instead of calling ShowAsync and HideAsync to update the flag, call offcanvas?.ShowAsync() and offcanvas?.HideAsync().
Example:
<Offcanvas@ref="offcanvas"title="Offcanvas">
<BodyTemplate>
<div>Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.</div>
<divclass="dropdown mt-3">
<buttonclass="btn btn-secondary dropdown-toggle"type="button"id="dropdownMenuButton"data-bs-toggle="dropdown">Dropdown button</button>
<ulclass="dropdown-menu"aria-labelledby="dropdownMenuButton">
<li><aclass="dropdown-item"href="#">Action</a></li>
<li><aclass="dropdown-item"href="#">Another action</a></li>
<li><aclass="dropdown-item"href="#">Something elsehere</a></li>
</ul>
</div>
<divclass="mt-3">
<ButtonColor="ButtonColor.Primary"@onclick="OnHideOffcanvasClick">Hide Offcanvas</Button>
</div>
</BodyTemplate>
</Offcanvas>
<ButtonColor="ButtonColor.Primary"@onclick="OnShowOffcanvasClick">Show offcanvas</Button>
It could greatly simplify the use of the offcanvas if rather than needing a reference to it so one can call ShowAsync() and HideAsync(), if it an "IsVisible" property that could be bound. Behind the scenes, in the setter, it could call Show/Hide.
Some simple pseudo code to demonstrate.
The text was updated successfully, but these errors were encountered: