hello,
I'm currently working on a portion of a program where when you click new it clears out the carousel with the xamcarouselviewpanel.children.clear , the part I'm having trouble with is bringing that same picture back if you click cancel. I have tried adding it again but then 2 of the same picture are shown. any ideas?
Thanks in advance,
Joel
Hi,
If you debug the code, does the carouselPanel contain one or two items after the cancel? If it contains two items, then perhaps the code which adds the item back is being called twice.
Yes, that what is happening, It's fine when I want to load the picture for the first time, but if I want to just add the new picture I'm kind of stuck. heres the code
Public Sub ShowImage(ByVal editkey As Int32)
With (cvImage.ViewSettings)
.IsListContinuous = True .AutoScaleItemContentsToFit = True .ItemPathStretch = Stretch.Fill .UseScaling = True .ItemsPerPage = 3 .ReserveSpaceForReflections = False
.ScalingEffectStops.Add(New ScalingEffectStop(0, 0.5)) .ScalingEffectStops.Add(New ScalingEffectStop(0.5, 3)) .ScalingEffectStops.Add(New ScalingEffectStop(1, 0.5))
.ItemTransitionStyle = PathItemTransitionStyle.AdjustSizeAndOpacity
Dim control As New ControlImage
'lblImagePosition.Content = "something"
End With
For Each row As DataRow In dtImages.Rows
Dim myImage2 As New Image() 'myImage2.Height = 1500 'myImage2.Width = 1500
Dim myBitmapImage2 As New BitmapImage() myBitmapImage2.BeginInit() Dim myUri2 As New Uri(CStr(row("ImagePath")))
myBitmapImage2.UriSource = myUri2 'myBitmapImage2.DecodePixelHeight = 1500 'myBitmapImage2.DecodePixelWidth = 1500 myBitmapImage2.EndInit() myImage2.Source = myBitmapImage2 myImage2.Tag = row("ImagePath") 'myImage2.Stretch = Stretch.Fill
cvImage.ChildElements.Add(myImage2) cvImage.UpdateLayout()
Next
end sub
I know the for each loop is bringing both the old row and the new one back, but I cant figure out a way to just bring back the new picture.
Thank you for the help,
The code you posted is not enough for me to replicate this problem. For instance, I don't know where ControlImage is defined. And where does DataRow come from - I thought you were working with a XamCarouselPanel?