
We are trying to use System.Windows.Shapes.Line with a Ribbon Button to imitate MS Office functionality. To create the functionality we are looking for, follow these steps:
1. Open MS PowerPoint 2007
2. Insert a Shape
3. On the Format Tab, click the Shape Outline Dropdown, then navigate down to Dashes … the Ribbon Button that shows the different line styles is what we are trying to recreate.
I can get this to work with a Combo Box, but this isn't quite what we are looking for because all the options are not shown in the Combo Box, it only shows one at a time with your selection.
Below is the code snipbit i am using to make the Combo Box functionality work. The Static Resources in the code below are created using the System.Windows.Shapes.Line.
Any thoughts / suggestions for how we get this to work properly?
1. Open MS PowerPoint 2007
2. Insert a Shape
3. On the Format Tab, click the Shape Outline Dropdown, then navigate down to Dashes … the Ribbon Button that shows the different line styles is what we are trying to recreate.
I can get this to work with a Combo Box, but this isn't quite what we are looking for because all the options are not shown in the Combo Box, it only shows one at a time with your selection.
Below is the code snipbit i am using to make the Combo Box functionality work. The Static Resources in the code below are created using the System.Windows.Shapes.Line.
<Line x:Key="_Solid" Height="16" Tag="Solid" StrokeThickness="3" Stroke="Black" X1="0" Y1="8" X2="70" Y2="8" x:Uid="Line_2" />
<Line x:Key="_Dash" Height="16" Tag="Dash" StrokeThickness="3" Stroke="Black" X1="0" Y1="8" X2="70" Y2="8" StrokeDashArray="2,2,2,2" x:Uid="Line_3" />
<Line x:Key="_DashDot" Height="16" Tag="DashDot" StrokeThickness="3" Stroke="Black" X1="0" Y1="8" X2="70" Y2="8" StrokeDashArray=".2,2,2,2" x:Uid="Line_4" />
<Line x:Key="_Dot" Height="16" Tag="Dot" StrokeThickness="3" Stroke="Black" X1="0" Y1="8" X2="70" Y2="8" StrokeDashArray="0.2, 2" x:Uid="Line_5" />
<Line x:Key="_DashDotDot" Tag="DashDotDot" Height="16" StrokeThickness="3" Stroke="Black" X1="0" Y1="8" X2="70" Y2="8" StrokeDashArray="0.2,2,0.2,2,2,2" x:Uid="Line_6" />
<ribbon:PopupButton Label="Dashes">
<ribbon:ComboBox HorizontalAlignment="Center" Command="{StaticResource ApplyLineTypeCommand}" IsPreviewEnabled="False" >
<ribbon:ComboBox.ItemsSource>
<x:Array Type="{x:Type Controls:QCComboBoxItem}">
<Controls:QCComboBoxItem Content="{StaticResource _Solid}"/>
<Controls:QCComboBoxItem Content="{StaticResource _Dash}"/>
<Controls:QCComboBoxItem Content="{StaticResource _DashDot}"/>
<Controls:QCComboBoxItem Content="{StaticResource _Dot}"/>
<Controls:QCComboBoxItem Content="{StaticResource _DashDotDot}"/>
</x:Array>
</ribbon:ComboBox.ItemsSource>
</ribbon:ComboBox>
</ribbon:PopupButton>