Hi Telerik,
I'm using a RadDiagram with a custom RadDiagramConnection :
<
Style
TargetType
=
"diagramscontrols:RadDiagramConnection"
x:Key
=
"RadDiagramConnectionStyle_RotateText"
>
<
Setter
Property
=
"StrokeThickness"
Value
=
"1"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"FocusVisualStyle"
Value
=
"{x:Null}"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:RadDiagramConnection"
>
<
Grid
x:Name
=
"RootTemplate"
MinHeight
=
"0"
HorizontalAlignment
=
"Stretch"
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"SelectionStates"
>
<
VisualState
x:Name
=
"Selected"
/>
<
VisualState
x:Name
=
"SelectedInGroup"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"SelectedInGroupPath"
Storyboard.TargetProperty
=
"Visibility"
Duration
=
"0"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Unselected"
/>
<
VisualState
x:Name
=
"SelectedAsGroup"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"EditMode"
>
<
VisualState
x:Name
=
"NormalMode"
/>
<
VisualState
x:Name
=
"NormalEditMode"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"NormalContent"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"EditContent"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"TextBoxEditMode"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"NormalContent"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Collapsed</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"EditTextBox"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Path
x:Name
=
"DeferredPath"
Stroke
=
"{TemplateBinding Stroke}"
Opacity
=
"0.7"
Fill
=
"{TemplateBinding Background}"
StrokeThickness
=
"{TemplateBinding StrokeThickness}"
StrokeDashArray
=
"2 2"
/>
<
Path
x:Name
=
"SelectedInGroupPath"
Visibility
=
"Collapsed"
Stroke
=
"Green"
/>
<
Path
Stroke
=
"{TemplateBinding Stroke}"
Fill
=
"{TemplateBinding Background}"
StrokeThickness
=
"{TemplateBinding StrokeThickness}"
x:Name
=
"GeometryPath"
StrokeDashArray
=
"{TemplateBinding StrokeDashArray}"
/>
<
Grid
x:Name
=
"EdittingElement"
RenderTransformOrigin
=
"0.5 0.5"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
Grid.LayoutTransform
>
<
RotateTransform
>
<
RotateTransform.Angle
>
<
MultiBinding
Converter
=
"{StaticResource PointsToAngleConverter}"
>
<
Binding
Path
=
"StartPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
Path
=
"EndPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
ElementName
=
"DeferredPath"
Path
=
"Data"
/>
</
MultiBinding
>
</
RotateTransform.Angle
>
</
RotateTransform
>
</
Grid.LayoutTransform
>
<
Border
Background
=
"Transparent"
/>
<
TextBlock
x:Name
=
"NormalContent"
Foreground
=
"{TemplateBinding Foreground}"
FontFamily
=
"{TemplateBinding FontFamily}"
FontSize
=
"{TemplateBinding FontSize}"
Text
=
"{TemplateBinding Content}"
TextAlignment
=
"{Binding Tag.TextAlignement, RelativeSource={RelativeSource AncestorType=diagramscontrols:RadDiagramConnection}}"
HorizontalAlignment
=
"{Binding Tag.HorizontalTextAlignement, RelativeSource={RelativeSource AncestorType=diagramscontrols:RadDiagramConnection}}"
VerticalAlignment
=
"Center"
>
<
TextBlock.Margin
>
<
MultiBinding
Converter
=
"{StaticResource MarginConverter}"
>
<
Binding
Path
=
"StartPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
Path
=
"EndPoint"
RelativeSource
=
"{RelativeSource AncestorType=telerik:RadDiagramConnection}"
/>
<
Binding
Path
=
"ActualHeight"
RelativeSource
=
"{RelativeSource Self}"
/>
</
MultiBinding
>
</
TextBlock.Margin
>
</
TextBlock
>
<
ContentPresenter
x:Name
=
"EditContent"
Visibility
=
"Collapsed"
Content
=
"{TemplateBinding Content}"
ContentTemplate
=
"{TemplateBinding EditTemplate}"
/>
<
TextBox
x:Name
=
"EditTextBox"
Visibility
=
"Collapsed"
>
<
TextBox.InputBindings
>
<
KeyBinding
Key
=
"Enter"
Command
=
"ApplicationCommands.NotACommand"
/>
</
TextBox.InputBindings
>
</
TextBox
>
</
Grid
>
</
Grid
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
To save my diagram, I'm using this code :
Dim
pathDiagram
As
String
= myDiagram.Save()
Dim
xml_doc
As
XDocument = XDocument.Parse(pathDiagram)
The problem is that I want to save the HorizontalAlignement of the text in my custom RadDiagramConnection, and I don't know how I can do this.
For custom TextShape, the HorizontalAlignement is saved, like in the attached picture.
Do you know how I can add the save of HorizontalAlignement property during Diagram saving ?
Thank you.
Valentin.