Hello,
Welcome to our Microsoft Q&A platform!
I write a simple code about your needs from your screenshot. I add this layout in your pancakeview:PancakeView
, I use DataTrigger
to control the Gird
appear or disappear. When Box button is appear, Gird
is disappear, the reverse is also the same.
<pancakeview:PancakeView HorizontalOptions="End"
VerticalOptions="End"
Margin="30"
CornerRadius="40"
Padding="15"
BackgroundColor="CornflowerBlue">
<Grid>
<Button IsVisible="{Binding IsAppear}" Command="{Binding IconShow}" WidthRequest="40" HeightRequest="40" CornerRadius="20" >
<Button.ImageSource>
<FontImageSource
FontFamily="fa"
Glyph="{x:Static icon:IconFont.Box}"
Size="20"
/>
</Button.ImageSource>
</Button>
<Grid>
<Grid.Triggers>
<DataTrigger TargetType="Grid" Binding="{Binding IsAppear}" Value="True">
<Setter Property="IsVisible" Value="False" />
</DataTrigger>
</Grid.Triggers>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<Label Text="Person" HorizontalOptions="End" Grid.Row="0" VerticalOptions="Center"></Label>
<Button Grid.Row="0" Grid.Column="1" WidthRequest="40" HeightRequest="40" CornerRadius="20" >
<Button.ImageSource>
<FontImageSource
FontFamily="mat"
Glyph="{x:Static icon:Material.Person}"
Size="20"
/>
</Button.ImageSource>
</Button>
<Label Text="Log out" HorizontalOptions="End" Grid.Row="1" VerticalOptions="Center"></Label>
<Button Grid.Row="1" Grid.Column="1" WidthRequest="70" HeightRequest="70" CornerRadius="35" >
<Button.ImageSource>
<FontImageSource
FontFamily="mat"
Glyph="{x:Static icon:Material.Logout}"
Size="20"
/>
</Button.ImageSource>
</Button>
<Label Text="Add" HorizontalOptions="End" Grid.Row="2" VerticalOptions="Center"></Label>
<Button Grid.Row="2" Grid.Column="1" WidthRequest="70" HeightRequest="70" CornerRadius="35" >
<Button.ImageSource>
<FontImageSource
FontFamily="mat"
Glyph="{x:Static icon:Material.Add}"
Size="20"
/>
</Button.ImageSource>
</Button>
<Label Text="New conversation" HorizontalOptions="End" Grid.Row="3" VerticalOptions="Center"></Label>
<Button Grid.Row="3" Grid.Column="1" WidthRequest="70" HeightRequest="70" CornerRadius="35" Command="{Binding IconShow}" >
<Button.ImageSource>
<FontImageSource
FontFamily="fa"
Glyph="{x:Static icon:IconFont.BoxOpen}"
Size="20"
/>
</Button.ImageSource>
</Button>
</Grid>
</Grid>
</pancakeview:PancakeView>
And I edit your MainPageViewModel.cs
, I add the IsAppear
Property and IconShow
command. IsAppear
Property to control the layout is appear or disappear when you click the Box Button.
[AddINotifyPropertyChangedInterface]
public class MainPageViewModel {
[JsonIgnore]
public Action OnAnyPropertiesChanged { get; set; }
private void OnPropertyChanged()
{
OnAnyPropertiesChanged?.Invoke();
}
[OnChangedMethod(nameof(OnPropertyChanged))]
public bool IsAppear { get; set; }
readonly FirebaseServices Servces;
readonly Notebook Notebook;
public ICommand CreateNotebook { get; set; }
public ICommand IconShow { get; set; }
public ObservableCollection<Notebook> Notebooks { get; set; }
public ICommand Logout { get; set; }
public MainPageViewModel() {
IsAppear = true;
Notebooks = new ObservableCollection<Notebook>();
// Logout = new Command(LogOut);
// CreateNotebook = new Command(NewNotebook);
// CallNotebooks();
IconShow = new Command(()=> {
IsAppear = !IsAppear;
});
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.