I made a class inherited raddiagramshape class and add "Forename" and "ForenameHorizontalAlignment" to this.
I changed template of SettingsPaneView and I added Horizontal alignment for shape, you can see this in image below.
My template add is
<
ListBox
Grid.Column
=
"0"
ScrollViewer.HorizontalScrollBarVisibility
=
"Disabled"
ScrollViewer.VerticalScrollBarVisibility
=
"Disabled"
HorizontalAlignment
=
"Left"
extensions:SettingsPaneView.EditorPropertyName
=
"ForenameHorizontalAlignment"
extensions:SettingsPaneView.EditorItemType
=
"Shapes, Connections"
extensions:SettingsPaneView.EditorValue
=
"{Binding Path=SelectedIndex, RelativeSource={RelativeSource Self}, Mode=TwoWay, Converter={StaticResource HorizontalAlignmentConverter}}"
>
<
ListBox.ItemsPanel
>
<
ItemsPanelTemplate
>
<
WrapPanel
IsItemsHost
=
"True"
/>
</
ItemsPanelTemplate
>
</
ListBox.ItemsPanel
>
<
ListBoxItem
>
<!--Left Alignment-->
<
Path
Width
=
"26"
Height
=
"26"
Stretch
=
"Fill"
Data
=
"M 0,4L 24,4 M 0,10L 12,10 M 0,16L 24,16 M 0,22L 12,22 M 0,28L 24,28 M 0,0L 32,0L 32,32L 0,32L 0,0 Z"
Stroke
=
"Black"
StrokeThickness
=
"1.5"
/>
</
ListBoxItem
>
<
ListBoxItem
>
<!--Center Alignment-->
<
Path
Width
=
"26"
Height
=
"26"
Stretch
=
"Fill"
Data
=
"M 4,4L 28,4 M 10,10L 22,10 M 4,16L 28,16 M 10,22L 22,22 M 4,28L 28,28 M 0,0L 32,0L 32,32L 0,32L 0,0 Z"
Stroke
=
"Black"
StrokeThickness
=
"1.5"
/>
</
ListBoxItem
>
<
ListBoxItem
>
<!--Right Alignment-->
<
Path
Width
=
"26"
Height
=
"26"
Stretch
=
"Fill"
Data
=
"M 8,4L 32,4 M 19,10L 32,10 M 8,16L 32,16 M 19,22L 32,22 M 8,28L 32,28 M 0,0L 32,0L 32,32L 0,32L 0,0 Z"
Stroke
=
"Black"
StrokeThickness
=
"1.5"
/>
</
ListBoxItem
>
</
ListBox
>
and HorizontalAlignmentConverter is
[ValueConversion(
typeof
(System.Windows.HorizontalAlignment),
typeof
(
int
))]
public
class
HorizontalAlignmentConverter : IValueConverter
{
#region IValueConverter Members
public
object
Convert(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
if
(value !=
null
)
{
switch
((
int
)value)
{
case
0:
return
System.Windows.HorizontalAlignment.Left;
case
2:
return
System.Windows.HorizontalAlignment.Right;
default
:
return
System.Windows.HorizontalAlignment.Center;
}
}
return
System.Windows.HorizontalAlignment.Center;
}
public
object
ConvertBack(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
if
(value ==
null
)
return
1;
System.Windows.HorizontalAlignment _value = (System.Windows.HorizontalAlignment)value;
switch
(_value)
{
case
System.Windows.HorizontalAlignment.Left:
return
0;
case
System.Windows.HorizontalAlignment.Right:
return
2;
default
:
return
1;
}
}
#endregion
}
when I add a shape into diagram and open settingpane I can change horizontal alignment of forename(for example change to left) but when again open sttingpane it show me center. I checked it and I see always Convertback value is null.?
how can I fix it?