Image is not diplaying in custom marker.

Jun 30, 2010 at 4:31 AM

In WPF Application, am using same Custom Marker showed in Demo of GMap. But adding rather than simple lable i want to add image.

Public Sub New(ByVal window As GMapTruckLocator, ByVal marker As GMapMarker, ByVal title As String)
        Me.InitializeComponent()

        Me.MainWindow = window
        Me.Marker = marker

        Popup = New Popup()
        stkPanel = New StackPanel()
        Label = New Label()
        TruckImage = New Image()

        Popup.Placement = PlacementMode.Mouse
        If True Then
            stkPanel.Background = Brushes.LightYellow
            stkPanel.Orientation = Orientation.Vertical

            Label.Background = Brushes.Gold
            Label.HorizontalAlignment = Windows.HorizontalAlignment.Stretch
            Label.Foreground = Brushes.LightYellow
            Label.BorderBrush = Brushes.WhiteSmoke
            Label.BorderThickness = New Thickness(2)
            Label.Padding = New Thickness(5)
            Label.FontSize = 14
            Label.Content = title

            stkPanel.Children.Add(Label)

            TruckImage.Width = 75
            TruckImage.Height = 75

            Dim bmapImg As New BitmapImage
            'bmapImg.CacheOption = BitmapCacheOption.Default
            bmapImg.BeginInit()
            bmapImg.UriSource = New Uri("Images/Truck1.jpg", UriKind.Relative)
            bmapImg.EndInit()

            TruckImage.Source = bmapImg
            stkPanel.Children.Add(TruckImage)

        End If
        Popup.Child = stkPanel
End Sub

By this Label which i added in stack panel is coming but image is not displaying. There is nothing wrong with Image Path.

What could be a problem?

Thanks!!!

 

Coordinator
Jun 30, 2010 at 4:59 AM
Edited Jun 30, 2010 at 5:00 AM

 

src.BeginInit();
src.UriSource = new Uri("picture.jpg", UriKind.Relative);
src.CacheOption = BitmapCacheOption.OnLoad;
src.EndInit();

 

Jun 30, 2010 at 5:21 AM

Sir not able to understand where this src came?

Let me describe once again. In a map for one location i put a pin with bigMarkerGreen.png now when user mouse hover to this pin i need to show lable as well as image. so i take a stack panel & did as above. now problem is with binding  TruckImage.Source = bmapImg Truck image is not displaying.

I tried all option of CatcheOption

 bmapImg.CacheOption = BitmapCacheOption.OnLoad, Default

but still image is not displaying.

 

Thanks

Coordinator
Jun 30, 2010 at 5:35 AM

g ;D bmapImg == src