Closed
Description
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.
<togglebutton IsSelected="@Model.IsShowingCanvas" />
<blazorbootstrap.offcanvas IsVisible="@Model.IsShowingCanvas" />
private bool _isVisible;
[Parameter] public bool IsVisible
{
get => _isVisible;
set
{
if (value == _isVisible)
{
return;
}
_isVisible = value;
if (value)
{
ShowAsync();
}
else
{
HideAsync();
}
}
}
public Task ShowAsync() {
_isVisible = true;
//rest of code
}
public Task HideAsync() {
_isVisible = false;
//rest of code
}