Click here to Skip to main content
15,892,298 members
Home / Discussions / WPF
   

WPF

 
QuestionSilverlight? A future? Pin
Sean McPoland26-Dec-14 23:46
Sean McPoland26-Dec-14 23:46 
AnswerRe: Silverlight? A future? Pin
Richard MacCutchan26-Dec-14 23:57
mveRichard MacCutchan26-Dec-14 23:57 
AnswerRe: Silverlight? A future? Pin
Pete O'Hanlon27-Dec-14 2:03
mvePete O'Hanlon27-Dec-14 2:03 
QuestionWhat are those automation peer in WPF? Pin
Super Lloyd22-Dec-14 0:55
Super Lloyd22-Dec-14 0:55 
AnswerRe: What are those automation peer in WPF? Pin
Pete O'Hanlon22-Dec-14 1:32
mvePete O'Hanlon22-Dec-14 1:32 
AnswerRe: What are those automation peer in WPF? Pin
syed shanu23-Dec-14 17:42
professionalsyed shanu23-Dec-14 17:42 
QuestionRouted Event No Responding Pin
Kevin Marois18-Dec-14 9:20
professionalKevin Marois18-Dec-14 9:20 
QuestionBest way to stroke a path with TWO colors? Pin
SledgeHammer0117-Dec-14 11:17
SledgeHammer0117-Dec-14 11:17 
First the main issue:

I have a Path that I create at runtime and show it on a custom control. This part works perfect. The visual tree is simple:

Control
-Line
-Control
--Grid
---Path

UseLayoutRound=True, SnapToDevicePixels=True. Line is a 1 pixel tall horizontal line and the user can customize the vertical position.

I need to stroke the path in two different colors. One color for above the line and one color for below the line. Typical solution I see is to use a 2 color brush. However, as you might suspect, it is *EXTREMELY CRITICAL* visually that the color change happen *EXACTLY* on the horizontal line. +/- 1 pixel is not acceptable.

The problem I'm having seems to be to align the color change on the line 100% of the time. For example, if my control is 99 pixels high and the threshold is at 50%, I should have 49 + 1 + 49.

I have tried the following solutions… problems I encountered are listed as well. Any way to get this working perfectly 100% of the time?

1) Vertical LinearGradientBrush

Generally works and hits the line 100% of the time, but it doesn’t give me a hard break between the two colors, so for example black going into white will leave a gray line

2a) DrawingBrush with RectangleGeometries
2b) DrawingBrush with DrawingContext

Both of these ideas have the same problem. I can’t hit the line 100% of the time (round off errors I’m guessing…) but I’m using the same math as with #1, so…

I can get a hard color change with both these, but I get +/- 1 pixel off errors…
SuggestionRe: Best way to stroke a path with TWO colors? Pin
Matt T Heffron17-Dec-14 11:39
professionalMatt T Heffron17-Dec-14 11:39 
GeneralRe: Best way to stroke a path with TWO colors? Pin
SledgeHammer0117-Dec-14 12:06
SledgeHammer0117-Dec-14 12:06 
QuestionWPF DataGrid Date Format Pin
Kevin Marois17-Dec-14 7:21
professionalKevin Marois17-Dec-14 7:21 
GeneralRe: WPF DataGrid Date Format Pin
PIEBALDconsult17-Dec-14 8:12
mvePIEBALDconsult17-Dec-14 8:12 
GeneralRe: WPF DataGrid Date Format Pin
Kevin Marois17-Dec-14 8:21
professionalKevin Marois17-Dec-14 8:21 
GeneralRe: WPF DataGrid Date Format Pin
Richard MacCutchan17-Dec-14 9:38
mveRichard MacCutchan17-Dec-14 9:38 
GeneralRe: WPF DataGrid Date Format Pin
Kevin Marois17-Dec-14 9:42
professionalKevin Marois17-Dec-14 9:42 
GeneralRe: WPF DataGrid Date Format Pin
Maciej Los17-Dec-14 11:14
mveMaciej Los17-Dec-14 11:14 
GeneralRe: WPF DataGrid Date Format Pin
Kevin Marois17-Dec-14 11:16
professionalKevin Marois17-Dec-14 11:16 
GeneralRe: WPF DataGrid Date Format Pin
Maciej Los17-Dec-14 11:19
mveMaciej Los17-Dec-14 11:19 
AnswerRe: WPF DataGrid Date Format Pin
Pete O'Hanlon17-Dec-14 11:38
mvePete O'Hanlon17-Dec-14 11:38 
GeneralRe: WPF DataGrid Date Format Pin
Kevin Marois17-Dec-14 11:40
professionalKevin Marois17-Dec-14 11:40 
GeneralRe: WPF DataGrid Date Format Pin
Pete O'Hanlon17-Dec-14 11:41
mvePete O'Hanlon17-Dec-14 11:41 
GeneralRe: WPF DataGrid Date Format Pin
Kevin Marois17-Dec-14 11:42
professionalKevin Marois17-Dec-14 11:42 
QuestionWPF Programmatically Adding Control To Grid - Wire Event Pin
Kevin Marois16-Dec-14 13:02
professionalKevin Marois16-Dec-14 13:02 
AnswerRe: WPF Programmatically Adding Control To Grid - Wire Event Pin
Richard MacCutchan16-Dec-14 21:39
mveRichard MacCutchan16-Dec-14 21:39 
GeneralRe: WPF Programmatically Adding Control To Grid - Wire Event Pin
Kevin Marois17-Dec-14 5:49
professionalKevin Marois17-Dec-14 5:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.