Bug - background color

3 posts, 1 answers
  1. Jason D
    Jason D avatar
    130 posts
    Member since:
    Jan 2011

    Posted 09 Aug 2018 Link to this post

    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. Answer
    Dinko
    Admin
    Dinko avatar
    1124 posts

    Posted 13 Aug 2018 Link to this post

    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.
  3. Jason D
    Jason D avatar
    130 posts
    Member since:
    Jan 2011

    Posted 13 Aug 2018 Link to this post

    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.
Back to Top