Can WPF Chart StripLines be Vertical

I notice in ASP.Net striplines have a Vertical property, but can't see that in the WPF control. Can you confirm if it is possible or recommend a workaround. 

I want to draw vertical strips on the chart not horizontal ones....

Troy

11 Replies

SS Sheik Syed Abthaheer M Syncfusion Team June 10, 2013 07:36 AM UTC

Hi Troy,

Thanks for using Syncfusion products.

We are glad to inform you that, you can achieve your requirement(Vertical Strip line) by applying StripLines into Chart PrimaryAxis as shown in the given below code snippet.

Code snippet [Xaml]:

<syncfusion:ChartArea.PrimaryAxis>

                        <syncfusion:ChartAxis>

                            <syncfusion:ChartAxis.StripLines>

                                <syncfusion:ChartStripLine x:Name="XAxisStripline1"  StartFromAxis="True" Offset="0" Width="2" TextRotationAngle="270">

                                </syncfusion:ChartStripLine>

                            </syncfusion:ChartAxis.StripLines>

                        </syncfusion:ChartAxis>

                       

 </syncfusion:ChartArea.PrimaryAxis>

 

We have prepared the sample based on your requirement. Please download the sample from the given below location.

Please let us know if you have any queries.

Regards,

M. Sheik



VerticalStriplineDemo_b37e5488.zip


SN Steele Nickle April 3, 2025 01:56 AM UTC

From Snow Rider 3D

Thank you so much for the support code.



PR Preethi Rajakandham Syncfusion Team April 3, 2025 05:55 AM UTC

Hi Steele Nickle,

You're welcome! Please let us know if you need any further assistance with this. We would be happy to help you.

Regards,

Preethi R



DD driving directions May 7, 2025 06:59 AM UTC

Interesting thread! Seeing how WPF chart striplines can be manipulated vertically really opens up new ways to visualize data in motion. It actually reminds me of how Mapquest visually represents traffic flow and road conditions—layering directional info in a way that’s both clear and context-aware. Just like striplines help highlight key values in charts, MapQuest highlights key turns and congestion zones on the map—both guiding users with visual precision.



JB jun Bon July 4, 2025 07:06 AM UTC

In WPF Chart, StripLines are typically horizontal, as the control does not directly support vertical StripLines like in ASP.NET. However, you can achieve a similar effect by using Vertical Line Annotations or by overlaying a Rectangle on the chart at the desired X-axis position to simulate vertical strips.



NI nicholascarson July 8, 2025 01:44 AM UTC

@quordle

In WPF, the built-in charting controls do not provide a direct property to create vertical StripLines like you would find in ASP.NET. However, you can achieve a similar effect using a combination of custom drawing and chart features.



BX barker xavierr July 21, 2025 06:14 AM UTC

Yeah, I ran into the same issue in WPF—unlike ASP.NET, the StripLine doesn’t have a built-in Vertical property. I had to fake it by drawing custom visual elements on the chart canvas, which felt more like a Drift Boss workaround than a clean solution—just weaving through gaps to get the visual right. Would be great if MS added proper vertical support natively.



TA Theresa A. Roberson July 25, 2025 06:49 AM UTC

I've run into this with WPF charts before too. You're right, there isn't a direct "Vertical" property like in ASP.NET. A workaround could be to use Line shapes and bind their X1, X2, and Y coordinates to your chart's axis values. You'd essentially be creating your own vertical strip lines that way. It's a bit more manual, but gives you full control. Think of it like building your own Eggy Car, you adapt the tools you have! Hope that helps!



JM James Mills August 11, 2025 04:48 AM UTC

Exploring UI elements often reveals subtle differences between frameworks. While ASP.Net striplines offer a Vertical property for customization, WPF controls seem to lack this feature, making vertical orientation a bit tricky. I once faced a similar challenge when trying to rotate chart labels in a WPF app, ultimately using a RenderTransform workaround to achieve the desired effect. Maybe integrating Omegle’s live chat UI inspired some creative solutions.



EC Eliza Colleano September 27, 2025 06:12 AM UTC

Is it possible to have vertical StripLines in WPF Charts? I recently discovered that ASP.Net striplines have a Vertical property, but I cannot find it in the WPF control. Can anyone confirm if vertical strips can be achieved, or suggest a workaround? I prefer vertical strips for my chart, similar to how you click cookies in Cookie Clicker to earn more!



VM Vidyalakshmi Mani Syncfusion Team September 30, 2025 11:17 AM UTC

Hi Troy,


Vertical StripLines in WPF Charts can be implemented by applying ChartStripLine to the PrimaryAxis, which typically represents the X-axis. This causes the strip to render vertically across the chart.


Define the strip lines within the StripLines collection of your PrimaryAxis.


XAML

 

<chart:SfChart>

. . .

    <chart:SfChart.PrimaryAxis>

        <chart:DateTimeAxis>

            <chart:DateTimeAxis.StripLines>

                <chart:ChartStripLines>

                    <chart:ChartStripLine x:Name="stripLine1"

                                          Width="20"                     

                                          Background="LightBlue"

                                          Opacity="0.5" />

                    <chart:ChartStripLine x:Name="stripLine2"

                                          Width="20"                     

                                          Background="GreenYellow"

                                          Opacity="0.5" />

                </chart:ChartStripLines>

            </chart:DateTimeAxis.StripLines>

        </chart:DateTimeAxis>

    </chart:SfChart.PrimaryAxis>

. . .

</chart:SfChart>

 


Assign the start positions for the strip lines using the desired dates in your code behind.


C#

 

stripLine1.Start = new DateTime(2023, 03, 01).ToOADate();

stripLine2.Start = new DateTime(2023, 05, 01).ToOADate();

 


This setup will render two vertical strips at the specified dates with the specified width.

Check out the output below:

A graph with a line going up

AI-generated content may be incorrect.

Refer to our Knowledge Base article on How to display striplines in DateTimeAxis of WPF Chart. Also, check out the runnable sample attached here.


Regards,

Vidyalakshmi M.



Attachment: WpfForumApp_9ee752bd_553337f0.zip

Loader.
Up arrow icon