Current filter:
                                You should refresh the page.
                                  • Hello DevExpress Team,

                                    I have a question regarding the selection of MapCustomElements.

                                    Other MapItems (such as MapPolygon) inherit a "SelectedStroke" property from MapShapeBase.
                                    The MapCustomElement does not.
                                    Do you have an idea how to easily implement a change of the stroke color in case the item gets selected?

                                    My current approach (untested) would be to connect the custom elements datatemplate to a ViewModel which in turn has a property which could be binded as a stroke color.
                                    This seems like quite a overhead for this task.
                                    I would appreciate any hints you can give me.

                                    The reason why I'm using the MapCustomElement is because I need an ellipse with a fixed size across all zoom levels.

                                    Best regards,

                                    Dominik

                                1 Solution

                                Creation Date Importance Sort by

                                It is necessary to update template based on the DataContext.IsSelected property to highlight selected items. I have attached a sample project demonstrating this approach.

                                [XAML]
                                <local:IsSelectedToBrushConverter x:Key="isSelectedToBrushConverter" /> <ControlTemplate x:Key="Custom" > <Border Background="LightGray" BorderBrush="{Binding Path=IsSelected, Converter={StaticResource isSelectedToBrushConverter}}" BorderThickness="2" CornerRadius="4" Padding="4"> <TextBlock Text="{Binding Path=MapItem.Content}" ToolTip="{Binding Path=MapItem.Attributes[ToolTipAttribute].Value}" /> </Border> </ControlTemplate>
                                [C#]
                                public class IsSelectedToBrushConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (bool)value ? Brushes.Red : Brushes.Gray; }
                                • Dominik Olp 10.11.2019

                                  Thank you for your answer, that solves my problem!

                                  Another question regarding MapCustomElements:
                                  The Location property specifies the top left corner of the object.
                                  My gps data represent the Center of the object.
                                  Is there a way to move the MapCustomElement to center around the Location?

                                  Best regards,

                                  Dominik

                                • Constant (DevExpress Support) 10.11.2019

                                  Use TranslateTransform to change element position.

                                  [XAML]
                                  <Border.RenderTransform> <TranslateTransform X="-20" Y="-20"></TranslateTransform> </Border.RenderTransform>