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

Expand Zoom Slider by default

2 Answers 102 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 05 Apr 2016, 06:29 AM

I am following the example in the documentation for an external MapZoomBar at the bottom of this page which allows me to move the MapZoomBar to the top right.

2 questions:

  1. How do I expand the slider by default? I want it to look like the old zoom slider on Google Maps. On a combobox I could set .IsDropDownOpen = true; But here?
  2. The default expand direction behaviour for the slider appears to be up. Because this Map is inside a dialog which does not occupy the full screen, this means that the MapZoomBar expands up out of the dialog. If I maximise the dialog, there is not enough room and so it expands down - which is nice. How do I make it expand down all the time? This question kind of covers it for a combobox.

XAML:

<Grid>
    <Telerik:RadMap
        x:Name="RadMap1"
        ZoomLevel="{Binding Path=ZoomLevel, Mode=TwoWay}"
        Center="{Binding Path=ViewCentroid, Mode=TwoWay}"
        CommandBarVisibility="Collapsed"
        MiniMapExpanderVisibility="Collapsed"
        NavigationVisibility="Collapsed"
        ZoomBarPresetsVisibility="Collapsed"
        ZoomBarVisibility="Collapsed"
        ScaleVisibility="Collapsed">
    </Telerik:RadMap>
    <Telerik:MapZoomBar
        MapControl="{Binding ElementName=RadMap1}"
        VerticalAlignment="Top"
        HorizontalAlignment="Right"
        Margin="0 10 10 0" />
</Grid>

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 07 Apr 2016, 11:09 AM
Hello Jeremy,

Let me get straight to your questions.
  1. How do I expand the slider by default?
    Here I can give your couple suggestions. One of them is to get the RadDropDownButton from the template of the MapZoomBar control and set its is IsOpen property to True. You can do this by modifying the template of the control or using the ChildrenOfTypeExtensions.ChildrenOfType<T>() extension method.

    The second approach is to extract the ControlTemplate of the MapZoomBar control and remove the RadDropDownButton leaving only the RadSlider control .Or you can replace the button with another element if you prefer.
  2. How do I make the drop down expand all the time?
    You can change the position of the zoom bar's dropdown using the DropDownPlacement property of the RadDropDownButton from the template. By default the property is set to Top. You can use one of the approaches described in answer number 1 in order to change the drop down placement to Bottom. However, keep in mind that the drop down is rendered in a Popup element which will never go outside the window. The OS will always manage to fit the popup inside the screen. You can observe this behavior in the scenario described in your last reply where  you maximize the window and then the popup placement changes to bottom. However, if you change the template of MapZoomBar to use an element different than the drop down button you will avoid this behavior.

Please let me know if this information helps.
Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Jeremy
Top achievements
Rank 1
answered on 08 Apr 2016, 07:07 AM

Thanks Martin!

 

I think extracting the ControlTemplate and removing the RadDropDownButton altogether will be the way forward for me.

In the meantime I have just moved it down the bottom right of the map control to fix #2.

 

Cheers,

Jeremy

Tags
Map
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Jeremy
Top achievements
Rank 1
Share this question
or