dpbouchard
asked on
wpf canvas confusion
<Canvas Margin="2" Name="cvsText" Grid.Column="1" Grid.Row="1" ClipToBounds="True">
<Canvas Name="cvsChart" ClipToBounds="True"/>
<Canvas Name="cvsInputs" ClipToBounds="True"/>
</Canvas>
I have the above xaml for a 2d drawing app. On the cvsText object, I'm drawing the x and y grid lines and all works fine. On the cvsChart object, I'm drawing the polygon objects of my app. On the cvsInputs I need to draw the graphic objects that change based upon the user inputs. What I am trying to do is to use the cvsInputs canvas to draw things that I need to clear every time the user input changes, However, every time I write on that layer, using the below vb code, nothing happens. I've tried everything i could think of, changing the zindex of the canvas cvsInputs, the z index of the polygon, all to no avail. Any ideas as to why nothing I draw on the cvsInputs canvas shows up??? When I change only the target canvas to cvsChart, everything shows up just fine so I know the data is being read from the excel sheet just fine.
Private Sub DrawMacAdamsElipse()
Dim clsBBLCTR As classBBLCtr
Dim pl As Polyline
Dim intRow As Integer
Dim intLastRow As Integer
Dim dblX As Double
Dim dblY As Double
Canvas.SetZIndex(cvsInputs , 1)
cvsInputs.Children.Clear()
If CInt(_ws_ColorCalc.Range(_ rngCCTInde x.Address) .Value) > 1 Then
clsBBLCTR = _dictBBLCTR(_clsResults.Ta rgetCCT.To String)
If clsBBLCTR IsNot Nothing Then
'todo: add point code
End If
If CInt(_ws_ColorCalc.Range(_ rngNumMAEs teps.Addre ss).Value) > 1 Then
pl = New Polyline
pl.Stroke = Brushes.Black
pl.StrokeThickness = 2
'pl.FillRule = FillRule.EvenOdd
intRow = 1
intLastRow = _rngMacAdamsEllipse.Rows.C ount
Do
If intRow > intLastRow Then Exit Do
dblX = CDbl(GetCellValue(_ws_CIE1 976_MAE.Ra nge(_rngMa cAdamsElli pse.Addres s).Cells(i ntRow, 1)))
dblY = CDbl(GetCellValue(_ws_CIE1 976_MAE.Ra nge(_rngMa cAdamsElli pse.Addres s).Cells(i ntRow, 2)))
pl.Points.Add(NormalizePoi nt(New Point(dblX, dblY)))
intRow += 1
Loop
cvsInputs.Children.Add(pl)
End If
End If
End Sub
<Canvas Name="cvsChart" ClipToBounds="True"/>
<Canvas Name="cvsInputs" ClipToBounds="True"/>
</Canvas>
I have the above xaml for a 2d drawing app. On the cvsText object, I'm drawing the x and y grid lines and all works fine. On the cvsChart object, I'm drawing the polygon objects of my app. On the cvsInputs I need to draw the graphic objects that change based upon the user inputs. What I am trying to do is to use the cvsInputs canvas to draw things that I need to clear every time the user input changes, However, every time I write on that layer, using the below vb code, nothing happens. I've tried everything i could think of, changing the zindex of the canvas cvsInputs, the z index of the polygon, all to no avail. Any ideas as to why nothing I draw on the cvsInputs canvas shows up??? When I change only the target canvas to cvsChart, everything shows up just fine so I know the data is being read from the excel sheet just fine.
Private Sub DrawMacAdamsElipse()
Dim clsBBLCTR As classBBLCtr
Dim pl As Polyline
Dim intRow As Integer
Dim intLastRow As Integer
Dim dblX As Double
Dim dblY As Double
Canvas.SetZIndex(cvsInputs
cvsInputs.Children.Clear()
If CInt(_ws_ColorCalc.Range(_
clsBBLCTR = _dictBBLCTR(_clsResults.Ta
If clsBBLCTR IsNot Nothing Then
'todo: add point code
End If
If CInt(_ws_ColorCalc.Range(_
pl = New Polyline
pl.Stroke = Brushes.Black
pl.StrokeThickness = 2
'pl.FillRule = FillRule.EvenOdd
intRow = 1
intLastRow = _rngMacAdamsEllipse.Rows.C
Do
If intRow > intLastRow Then Exit Do
dblX = CDbl(GetCellValue(_ws_CIE1
dblY = CDbl(GetCellValue(_ws_CIE1
pl.Points.Add(NormalizePoi
intRow += 1
Loop
cvsInputs.Children.Add(pl)
End If
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.