Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

wpf canvas confusion

Avatar of dpbouchard
dpbouchardFlag for United States of America asked on
Microsoft Development
1 Comment1 Solution710 ViewsLast Modified:
<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(_rngCCTIndex.Address).Value) > 1 Then

            clsBBLCTR = _dictBBLCTR(_clsResults.TargetCCT.ToString)
            If clsBBLCTR IsNot Nothing Then

                'todo: add point code

            End If

            If CInt(_ws_ColorCalc.Range(_rngNumMAEsteps.Address).Value) > 1 Then

                pl = New Polyline
                pl.Stroke = Brushes.Black
                pl.StrokeThickness = 2
                'pl.FillRule = FillRule.EvenOdd

                intRow = 1
                intLastRow = _rngMacAdamsEllipse.Rows.Count

                Do

                    If intRow > intLastRow Then Exit Do

                    dblX = CDbl(GetCellValue(_ws_CIE1976_MAE.Range(_rngMacAdamsEllipse.Address).Cells(intRow, 1)))
                    dblY = CDbl(GetCellValue(_ws_CIE1976_MAE.Range(_rngMacAdamsEllipse.Address).Cells(intRow, 2)))
                    pl.Points.Add(NormalizePoint(New Point(dblX, dblY)))

                    intRow += 1

                Loop

                cvsInputs.Children.Add(pl)

            End If

        End If

    End Sub
ASKER CERTIFIED SOLUTION
Avatar of mikebirt
mikebirtFlag of United Kingdom of Great Britain and Northern Ireland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers