This is a migrated thread and some comments may be shown as answers.

Binding to DeleteButton Visibility

1 Answer 337 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
band
Top achievements
Rank 1
band asked on 31 Jan 2017, 05:17 AM
Hi my appointments have a active flag and when it's false, I would like the delete button to hide. I was reading that I should edit the schedule view xaml code but my bindings aren't correct. Any ideas?

<telerik:RadButton x:Name="DeleteButton"
            Style="{StaticResource DeleteButtonStyle}"
            Command="{x:Static local:RadScheduleViewCommands.DeleteAppointment}"
            ClickMode="Press"
            CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}}"
            Visibility="{Binding Active, Converter={StaticResource BooleanToVisibilityConverter}}"
            IsTabStop="False" />

               

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 31 Jan 2017, 09:48 AM
Hello,

I assume that Active is a custom property of the appointment, so you will have to use the following binding:

Visibility="{Binding Path=Appointment.Active,
Converter={StaticResource BooleanToVisibilityConverter}}"
It's needed as the DataContext is of type AppointmentItem which preserves the custom properties inside its Appointment property.

Hope this helps.

Regards,
Yana
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ScheduleView
Asked by
band
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or