Q2 2012 Diagram save method doesnt save the shape background

4 posts, 0 answers
  1. hal broad
    hal broad avatar
    7 posts
    Member since:
    May 2010

    Posted 20 Jun 2012 Link to this post

    I just installed Q2 2012 and now the diagram doesnt save the background of the shapes. 
    The background was properly saved in the previous version. I have included the diagram config and the 
    output file. the docs say Background is automatically saved but I am not getting it. I tried using the 
    serialize/deserialize methods but that just gives me a blank background for the shapes. 
    How can I get the background
    
    <tk:RadDiagram x:Name="diagram" HorizontalAlignment="Stretch" BorderThickness="0" Margin="5,2,2,2"
    		tk:DiagramSurface.IsVirtualizing="True" AllowCopy="False" IsPanEnabled="False" IsZoomEnabled="False" IsEditable="False"
                    AllowCut="False" AllowDelete="False" AllowPaste="False" IsConnectorsManipulationEnabled="False" IsBackgroundSurfaceVisible="False"
                    Loaded="diagram_Loaded" SizeChanged="diagram_SizeChanged" ShapeSerialized="diagram_ShapeSerialized" ShapeDeserialized="diagram_ShapeDeserialized"
                    Drag="diagram_Drag" Resize="diagram_Resize" Rotate="diagram_Rotate" ShapeClicked="diagram_ShapeClicked" >
    </tk:RadDiagram>
    
    
    
    <?xml version="1.0" encoding="utf-8"?>
    <RadDiagram Type="Telerik.Windows.Diagrams.Core.IGraphInternal" Version="2012.2">
    <Metadata Type="Telerik.Windows.Controls.RadDiagram" Id="9ca231cc-84d5-4729-ac75-6bf52c99cf99" BackgroundImage="C:\hal\Acclima\code\IrrigMgr\Map_346516.jpg" Zoom="1" Position="0;0" IsRotationEnabled="true" IsResizingEnabled="true" IsManipulationAdornerVisible="true" SelectionMode="Extended" IsSnapEnabled="true" SnapX="20" SnapY="20" IsBackgroundSurfaceVisible="false" IsEditable="false" IsDraggingEnabled="true" IsPanEnabled="false" IsZoomEnabled="false" IsConnectorsManipulationEnabled="false" AllowDelete="false" AllowCut="false" AllowCopy="false" AllowPaste="false">
    <Title>Diagram [6/20/2012 7:15:55 PM]</Title>
    <Description/>
    <Background>#FFFFFFFF</Background>
    </Metadata>
    <Groups />
    <Shapes QNs="Telerik.Windows.Controls.Diagrams, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7;">
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="65a360f7-d29d-4249-a31e-2bdfbaa9314b" ZIndex="1" Position="140;300" Content="1" Size="50;50" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M0.5,0.5L111.5,0.5 111.5,74.5 0.5,74.5z" QN="0" Tag="zone" Opacity="0.85" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="ed57edca-df4f-45b7-9ed0-623f1eafa076" ZIndex="1" Position="320;350" Content="2" Size="50;50" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M0.5,0.5L111.5,0.5 111.5,74.5 0.5,74.5z" QN="0" Tag="zone" Opacity="0.85" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="f8f09e12-11c8-4a9a-9abc-a6c623b7901d" ZIndex="1" Position="780;350" Content="3" Size="50;50" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M0.5,0.5L111.5,0.5 111.5,74.5 0.5,74.5z" QN="0" Tag="zone" Opacity="0.85" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="85f55681-3a7e-452e-a8cf-984d724a5309" ZIndex="1" Position="680;160" Content="1" Size="35;35" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M111.5,37.5C111.5,57.91 86.67,74.5 56,74.5 25.33,74.5 0.5,57.91 0.5,37.5 0.5,17.09 25.33,0.5 56,0.5 86.67,0.5 111.5,17.09 111.5,37.5z" QN="0" Tag="device" Opacity="0.85" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="b6dc0f75-efb2-4ce5-a196-0094494e86f2" ZIndex="1" Position="620;315" Content="5" Size="35;35" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M111.5,37.5C111.5,57.91 86.67,74.5 56,74.5 25.33,74.5 0.5,57.91 0.5,37.5 0.5,17.09 25.33,0.5 56,0.5 86.67,0.5 111.5,17.09 111.5,37.5z" QN="0" Tag="device" Opacity="0.85" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="c2387d2e-4851-4a06-914d-894206908a7f" ZIndex="1" Position="180;140" Content="10" Size="35;35" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M111.5,37.5C111.5,57.91 86.67,74.5 56,74.5 25.33,74.5 0.5,57.91 0.5,37.5 0.5,17.09 25.33,0.5 56,0.5 86.67,0.5 111.5,17.09 111.5,37.5z" QN="0" Tag="device" Opacity="0.85" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="f727cafc-5f14-46e4-9a79-84bfcd704130" ZIndex="1" Position="285;220" Content="7" Size="35;35" RotationAngle="0" Connectors="Auto:0.5;0.5,Left:0;0.5,Top:0.5;0,Right:1;0.5,Bottom:0.5;1," Geometry="M111.5,37.5C111.5,57.91 86.67,74.5 56,74.5 25.33,74.5 0.5,57.91 0.5,37.5 0.5,17.09 25.33,0.5 56,0.5 86.67,0.5 111.5,17.09 111.5,37.5z" QN="0" Tag="device" Opacity="0.85" />
    </Shapes>
    <Connections />
    </RadDiagram>
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 21 Jun 2012 Link to this post

    Hi,

     For the Q2 release, we have made some changes around the serialization mechanism. The visual properties like Background, Foreground, etc. are saved only when they are manually set (with a local value). This was needed to be consistent with the theming mechanism. For example, if you copy a shape in one theme and paste it in a diagram with a different theme, it should use the settings of the latter theme. In this case, setting these properties through a style (style's setter).

    However, if you do want to save these properties even though they are not locally set, you can handle the ShapeSerialized event.

    Kind regards,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. hal broad
    hal broad avatar
    7 posts
    Member since:
    May 2010

    Posted 25 Jun 2012 Link to this post

    Would you provide an example of how to do this for a background of a shape?
    Thanks.
  5. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 28 Jun 2012 Link to this post

    Hi,

     Setting the background locally, meaning setting it manually :
    <telerik:RadDiagramShape Background="Red" />
    or
    shape.Background = Brushes.Red.

    The other option is use a shape style, using the RadDiagram.ShapeStyle property. This way, even though the background is not serialized, it will be the same when deserialized, because of the style.

    Greetings,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top