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

set CommandButtonsVisibility via code behind

5 Answers 70 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Kurt
Top achievements
Rank 1
Kurt asked on 22 Feb 2018, 08:01 PM

Hi,

Can't seem to find the way to set CommandButtonsVisibility from code behind. I'm building a user control with dynamic behavior the DataForm.
In XAML it's easy and working.

Anybody that has an idea?

Thanks in advance!

Kurt

5 Answers, 1 is accepted

Sort by
0
Randy Hompesch
Top achievements
Rank 1
answered on 23 Feb 2018, 11:32 AM

If it'll help I did the job using xaml:

CommandButtonsVisibility="{Binding Path=MyCommandButtonVisibility, Source={x:Static Application.Current}}"

In this case the MyCommandButtonVisibility property was defined in app.xaml.cs.

You should be able to modify this to taste.

 

0
Accepted
Martin Ivanov
Telerik team
answered on 27 Feb 2018, 12:25 PM
Hi Kurt,

Here is an example how to set the CommandButtonsVisibility in code behind:
this.dataForm.CommandButtonsVisibility =
                Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Commit |
                Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Cancel;
This will show the OK and Cancel buttons.

Regards,
Martin Ivanov
Progress Telerik
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.
0
Kurt
Top achievements
Rank 1
answered on 27 Feb 2018, 02:53 PM
Works like a charm!! Thanks!
0
Gianni
Top achievements
Rank 1
answered on 28 Sep 2020, 12:55 PM

Hi Ivanov

is the property CommandButtonsVisibility Bindable? Because I cannot bind it nor convert it in any manner...

Thanks

Gianni.

 

0
Martin Ivanov
Telerik team
answered on 30 Sep 2020, 06:45 AM

Hello Gianni,

The CommandButtonsVisibility property of RadDataForm is a DependencyProperty which mean that you can data bind it. I've prepared a small example showing this. I hope this helps.

Regards,
Martin Ivanov
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
DataForm
Asked by
Kurt
Top achievements
Rank 1
Answers by
Randy Hompesch
Top achievements
Rank 1
Martin Ivanov
Telerik team
Kurt
Top achievements
Rank 1
Gianni
Top achievements
Rank 1
Share this question
or