This is a migrated thread and some comments may be shown as answers.

Bug - background color

2 Answers 16 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jason D
Top achievements
Rank 1
Veteran
Jason D asked on 09 Aug 2018, 03:38 PM

If the map background is bound to a property that has no initial value, the map will ignore the mouse unless using a child control. I only found one mention of anything simliar to this: https://arstechnica.com/civis/viewtopic.php?t=83073

<Window x:Class="MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <telerik:RadMap Background="{Binding MapBackground}">
        <telerik:RadMap.Provider>
            <telerik:OpenStreetMapProvider />
        </telerik:RadMap.Provider>
    </telerik:RadMap>
</Window>

 

Class MainWindow
    Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()
 
        ' Add any initialization after the InitializeComponent() call.
        DataContext = Me
    End Sub
 
    Public Property MapBackground As Media.Brush
End Class

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dinko
Telerik team
answered on 13 Aug 2018, 10:55 AM
Hello Jason,

Thank you for the provided code snippet.

The described behavior is expected for the WPF Framework. In this case, the initial value of the Brush property is null. When the Background is Null, the framework won't considered it for hit testing, and thus it won't be eligible for mouse events. You can observe the same behavior if you bind the Background property of a StackPanel framework element. If you don't want to set an initial color you can set the Background to Transparent. Setting it to Transparent the mouse events will be called.

I have prepared a sample project to demonstrate this behavior. When you run the project, you can observe 3 StackPanels. The first one has a Null background, the second has a Transparent background and the third one has a Blue background. You can observe that the mouse down event is not called for the first StackPanel.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jason D
Top achievements
Rank 1
Veteran
answered on 13 Aug 2018, 12:46 PM
Weird. Thank your for the information. I do want a background color, I just hadn't finished coding it yet. I'm redoing all of my map code, and not all of the initial data is there yet.
Tags
Map
Asked by
Jason D
Top achievements
Rank 1
Veteran
Answers by
Dinko
Telerik team
Jason D
Top achievements
Rank 1
Veteran
Share this question
or