Telerik RadDaigram does not contain definition for SwitchGridVisibility

610 Views Asked by At

I am trying to switch off the grid visibility of a RadDiagram I have.

I am creating a User Control using Telerik controls within a Silverlight Project (sharing the control with a WPF Library).

It seems that RadDiagram Property is not found. (RadDiagram Commands - Found property here)

PS: I am creating and filling the shape programmatically. Therefore, I need to an approach to switch the grid off that apply to Style attribute in Resource Dictionary or a simple programmatic property set / function call.

Thanks,

2

There are 2 best solutions below

1
On BEST ANSWER

The way to turn off the BackGroundGrid or BackGroundPageGrid is to use these attached properties:

 <telerik:RadDiagram x:Name="diagram" Margin="30"                           
                     primitives:BackgroundGrid.IsGridVisible="False"
                     primitives:BackgroundPageGrid.IsGridVisible="False"

where primitives is defined like so:

xmlns:primitives="clr-namespace:Telerik.Windows.Controls.Diagrams.Primitives; assembly=Telerik.Windows.Controls.Diagrams"

If you need to bind the command for switching the BackGroundGrid On / Off , you can use this syntax:

 <telerik:RadButton Command="telerik:DiagramCommands.SwitchGridVisibility"
                         CommandTarget="{Binding ElementName=diagram}"/>
0
On

Programmatically in code-behind here is how it is done:

Telerik.Windows.Controls.Diagrams.Primitives.BackgroundGrid.SetIsGridVisible(this.myDiagram, false); 

Source: Switch Grid Visibility