We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Losing Measurement units and grid lines when both defined in xaml using C# .net 4.0 vs 2010

I'm trying WPF diagram and the following code taken from a search of MeasurementUnits doesn't show both the grid lines and ruler measurement units at the same time. It shows only the measurement in inches but the grid lines disappear. What is wrong to cause this? Regards... Al

xaml code follows that I am using in for the WPF diagram

<Grid Grid.Column="2" Grid.RowSpan="3" Height="Auto" HorizontalAlignment="Left" Name="gridDiagram" VerticalAlignment="Stretch" Width="Auto" Grid.ColumnSpan="2">
                <syncfusion:DiagramControl Name="Schematic_Diagram"  Background="White" Grid.Column="2" Grid.RowSpan="3">
                    <syncfusion:DiagramControl.Model>
                        <syncfusion:DiagramModel x:Name="diagramModel">
                        </syncfusion:DiagramModel>
                    </syncfusion:DiagramControl.Model>
                    <syncfusion:DiagramControl.View>
                        <syncfusion:DiagramView x:Name="diagramView" ShowHorizontalGridLine="True" ShowVerticalGridLine="True">
                            <syncfusion:DiagramView.Page>
                            <syncfusion:DiagramPage x:Name="diagramPage" MeasurementUnits="Inch">
                            </syncfusion:DiagramPage>
                            </syncfusion:DiagramView.Page>
                            <syncfusion:DiagramView.HorizontalRuler>
                                <syncfusion:HorizontalRuler />
                            </syncfusion:DiagramView.HorizontalRuler>
                            <syncfusion:DiagramView.VerticalRuler>
                                <syncfusion:VerticalRuler />
                            </syncfusion:DiagramView.VerticalRuler>
                        </syncfusion:DiagramView>
                     </syncfusion:DiagramControl.View>
                </syncfusion:DiagramControl>
            </Grid>


1 Reply

SC Sudhakar C Syncfusion Team February 25, 2013 09:38 AM UTC

Hi Alan,

By default,  the grid lines are created based on the pixel values and also the default value of the GridHorizantal offset & Grid Vertical offset of the Diagram Page are such as 25,25 pixels (The grid lines are starting from 25 pixels). So that we can’t view the Grid Lines. However, If you want to view the Grid Lines, please change the GridHorizantalOffset and GridVerticalOffset Values based on the Measurement unit which you are using (if you change the Measurement unit). For more information please refer the following code snippet to set the  GridHorizantalOffset and GridVerticalOffset. Now, the Grid Lines will be create based on the Measurement unit which you are using.

Code Snippet :

(diagramView.Page as DiagramPage).GridHorizontalOffset = MeasureUnitsConverter.FromPixels((diagramView.Page as DiagramPage).GridHorizontalOffset, (diagramView.Page as DiagramPage).MeasurementUnits);

 

//Set the GridVerticalOffset

(diagramView.Page as DiagramPage).GridVerticalOffset = MeasureUnitsConverter.FromPixels((diagramView.Page as DiagramPage).GridVerticalOffset, (diagramView.Page as DiagramPage).MeasurementUnits);

 

Please let us know if you require further assistance on this.

Regards,

Sudhakar C


Loader.
Live Chat Icon For mobile
Up arrow icon