You might look at this question. It asks how to do line stipple in non-deprecated modern OpenGL, which is similar in functionality to Direct3D 10+.
My answer basically was to use a combination of alpha testing and the geometry shader to do it:
Perhaps you could also use a 1D texture with the alpha (or red)
channel encoding the pattern as 0.0 (no line) or 1.0 (line) and then
have the line's texture coordinate go from 0 to 1 and in the fragment
shader you make a simple alpha test, discarding fragments with alpha
below some threshold. You can facilitate the geometry shader to
generate your line's texCoords, as otherwise you need different vertices
for every line. This way you can also make the texCoord dependent on
the screen space length of the line.
The whole thing get's more difficult if you draw triangles (using
polygon mode GL_LINE). Then you have to do the triangle-line
transformation yourself in the geometry shader, putting in triangles
and putting out lines (that could also be a reason for deprecating
polygon mode in the future, if it hasn't already).
Although this question was about OpenGL, the basic principles are exactly the same, you just have to map the shaders from the answer to HLSL, which shouldn't be too difficult given their simplicity.