Telerik Forums
UI for WPF Forum
9 answers
278 views

Hi,

 

I'm using RadMap to load a simple ESRI shapefile containing points (described by latitude/longitude in associated dbf file).

I want to change the defaut icon used to draw the point (which is looking like a google map pin) to a single blue circle with a radius of one ou two pixel.

I want to change the color of the circle on mouse click for select it.

I tried to use VisualizationLayer.ShapeFill but it doesn't work.

Here is my code :

<UserControl x:Class="Example"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:POCMap"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
 
    <UserControl.Resources>
 
    </UserControl.Resources>
 
    <DockPanel>
 
        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Click="France_OnClick">France</Button>
            <Button Click="Roumanie_OnClick">Roumanie</Button>
            <Button Click="Yenne_OnClick">Yenne</Button>
        </StackPanel>
 
        <Grid DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Row ="0" Grid.Column="0">Latitude (°N)</TextBlock>
            <TextBox Grid.Row ="0" Grid.Column="1" x:Name="txtLatitude" KeyDown="TxtLatitudeLongitude_OnKeyDown"></TextBox>
            <TextBlock Grid.Row ="1" Grid.Column="0">Longitude (°E)</TextBlock>
            <TextBox Grid.Row ="1" Grid.Column="1" x:Name="txtLongitude" LostFocus="TxtLatitudeLongitude_OnLostFocus" KeyDown="TxtLatitudeLongitude_OnKeyDown"></TextBox>
        </Grid>
 
        <telerik:RadBusyIndicator Name="busyIndicator">
            <telerik:RadMap x:Name="radMap"  Center="40,-100" ZoomLevel="8" >
                <telerik:RadMap.Provider>
                    <telerik:ArcGisMapProvider x:Name="prov" Mode="Aerial" />
                </telerik:RadMap.Provider>
 
 
                <!--<telerik:InformationLayer x:Name="informationLayer"/>-->
 
                <telerik:VisualizationLayer x:Name="visualizationLayer" UseBitmapCache="False">
                    <telerik:VisualizationLayer.ZoomLevelGridList>
                        <telerik:ZoomLevelGrid MinZoom="0" />
                        <telerik:ZoomLevelGrid MinZoom="9" />
                        <telerik:ZoomLevelGrid MinZoom="8" />
                    </telerik:VisualizationLayer.ZoomLevelGridList>
 
                    <telerik:VisualizationLayer.ShapeFill>
                        <telerik:MapShapeFill Fill="#6FDFEFFF"
                                          Stroke="Blue"
                                          StrokeThickness="2" />
                    </telerik:VisualizationLayer.ShapeFill>
 
                    <telerik:VisualizationLayer.VirtualizationSource>
 
                        <telerik:MapShapeDataVirtualizationSource x:Name="mapShapeDataVirtualizationSource">
                            <telerik:MapShapeDataVirtualizationSource.Reader>
                                <!--<telerik:AsyncShapeFileReader Source="/POCMap;component/Resources/Time_Zones.shp" ToolTipFormat="Time Zone : {ZONE_}" /> -->
                                <telerik:AsyncShapeFileReader x:Name="mapShapeDataReader"
                                                               
                                                              ToolTipFormat="Latitude : {latitude} / Longitude : {longitude}"
                                                              ProgressChanged="OnProgressChanged"
                                                              ReadShapeDataCompleted="OnReadShapeDataCompleted"/>
 
 
                                 
 
                            </telerik:MapShapeDataVirtualizationSource.Reader>
                        </telerik:MapShapeDataVirtualizationSource>
                    </telerik:VisualizationLayer.VirtualizationSource>
                </telerik:VisualizationLayer>
 
 
            </telerik:RadMap>
        </telerik:RadBusyIndicator>
 
    </DockPanel>
 
 
</UserControl>

 

Imports System.Windows.Resources
Imports Telerik.Windows.Controls.Map
 
Public Class Example
    Public Sub New()
 
        ' Cet appel est requis par le concepteur.
        InitializeComponent()
 
        AddHandler Me.Loaded, AddressOf Page_Loaded
 
        ' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
        prov.Mode = ArcGisMapMode.Topographic
        radMap.Center = New Location(45.7, 5.75)
        radMap.ZoomLevel = 8
        radMap.MaxZoomLevel=8
        txtLatitude.Text = 45.7
        txtLongitude.Text = 5.75
 
        AddHandler Me.Loaded, AddressOf Me.ExampleLoaded
    End Sub
 
    Private Sub Page_Loaded(sender As Object, e As RoutedEventArgs)
        Me.mapShapeDataVirtualizationSource.ReadAsync()
    End Sub
 
    Private Sub TxtLatitudeLongitude_OnLostFocus(sender As Object, e As RoutedEventArgs)
        SetLocation()
    End Sub
 
    Private Sub TxtLatitudeLongitude_OnKeyDown(sender As Object, e As KeyEventArgs)
        If e.Key = Key.Enter Then
            SetLocation()
        End If
    End Sub
 
    Private Sub SetLocation()
        If txtLatitude.Text AndAlso txtLongitude.Text Then
            Dim latitude = CDbl(txtLatitude.Text)
            Dim longitude = CDbl(txtLongitude.Text)
            radMap.Center = New Location(latitude, longitude)
        End If
    End Sub
 
    Private Sub France_OnClick(sender As Object, e As RoutedEventArgs)
        radMap.Center = New Location(47.08, 2.39)
        radMap.ZoomLevel = 6
    End Sub
 
    Private Sub Roumanie_OnClick(sender As Object, e As RoutedEventArgs)
        radMap.Center = New Location(44.94, 26.96)
        radMap.ZoomLevel = 6
    End Sub
 
    Private Sub Yenne_OnClick(sender As Object, e As RoutedEventArgs)
        radMap.Center = New Location(45.7, 5.75)
        radMap.ZoomLevel = 13
    End Sub
     
    Private Sub ExampleLoaded(sender As Object, e As RoutedEventArgs)
        Me.busyIndicator.IsIndeterminate = False
        Me.busyIndicator.IsBusy = True
        Me.mapShapeDataReader.Source = New Uri("/POCMap;component/Resources/0.25deg_grille_EU.shp", UriKind.Relative)
    End Sub
  
    Private Sub OnProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs)
        Me.busyIndicator.ProgressValue = e.ProgressPercentage
        If e.ProgressPercentage >= 100 Then
            Me.busyIndicator.IsIndeterminate = True
            Me.busyIndicator.BusyContent = "Refresh layer"
        End If
    End Sub
  
    Private Sub OnReadShapeDataCompleted(sender As Object, e As Telerik.Windows.Controls.Map.ReadShapeDataCompletedEventArgs)
        If Me.busyIndicator IsNot Nothing Then
            Me.busyIndicator.IsBusy = False
        End If
    End Sub
End Class

 

Thanks for your help

Yoan

Yoan
Top achievements
Rank 1
Iron
 answered on 30 Apr 2021
2 answers
268 views

Hellp

 

In the previous post I asked a question and got an answer..
But there was a problem.

It is related to number 1. ( https://www.telerik.com/forums/is-a-custom-color-picker-possible )

 

It runs fine until the build is successful and I start debugging and finish.

Using <Setter Property = "local : CustomColorPickerOpenBehavior"Value = "True"/> crashes the designer.

Where xaml designer Exception was thrown.

 

InvalidOperationException: Sequence contains no matching element

 

 

Deleting the CustomColorPickerOpenBehavior property shows the xaml designer.

If the property is created again, an exception occurs.

 

What is the problem?

Thanks.


<Style TargetType="telerik:RadColorPicker" BasedOn="{StaticResource RadColorPickerStyle}">
	<Setter Property="Padding" Value="5" />
	<Setter Property="SplitButtonStyle">
		<Setter.Value>
			<Style TargetType="telerik:RadSplitButton" BasedOn="{StaticResource RadSplitButtonStyle}">
				<Setter Property="mat:MaterialAssist.FocusBrush"		Value="Transparent"/>
				<Setter Property="mat:MaterialAssist.MouseOverBrush"	Value="Transparent"/>
				<Setter Property="behaviour:ColorPickerButtonSync.IsEnabled" Value="True" />
				<Setter Property="IsChecked" Value="{Binding IsDropDownOpen, RelativeSource={RelativeSource AncestorType=telerik:RadColorPicker}}" />
			</Style>
		</Setter.Value>
	</Setter>
</Style>

<telerik:RadColorPicker Width="70" SelectedColor="Red" IsRecentColorsActive="True">
	<telerik:RadColorPicker.ContentTemplate>
		<DataTemplate>
			<Rectangle	Width="35" Height="25"
									Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerik:RadColorPicker}},
									Path=SelectedColor, Converter={StaticResource mediaToBrushConverter}}" />
		</DataTemplate>
	</telerik:RadColorPicker.ContentTemplate>

	<telerik:RadColorPicker.AdditionalContent>
		<ContentControl HorizontalContentAlignment="Stretch" Content="{Binding}" >
			<ContentControl.ContentTemplate>
				<DataTemplate>
					<Grid>
						<telerik:RadButton	Height="26" BorderThickness="0"
														HorizontalContentAlignment="Left"
														Command="{Binding OnClickOpenEditColorsCommand}"
														CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type telerik:RadColorPicker}}}"
														>
							<telerik:RadButton.Content>
								<TextBlock Text="More Colors..." Margin="26 0 0 0" />
							</telerik:RadButton.Content>
						</telerik:RadButton>
					</Grid>
				</DataTemplate>
			</ContentControl.ContentTemplate>
		</ContentControl>
	</telerik:RadColorPicker.AdditionalContent>
</telerik:RadColorPicker>

 

public class ColorPickerButtonSync
    {
        public static bool GetIsEnabled(DependencyObject obj)
        {
            return (bool)obj.GetValue(IsEnabledProperty);
        }

        public static void SetIsEnabled(DependencyObject obj, bool value)
        {
            obj.SetValue(IsEnabledProperty, value);
        }

        public static readonly DependencyProperty IsEnabledProperty =
            DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ColorPickerButtonSync), new PropertyMetadata(false, new PropertyChangedCallback(OnIsEnabledChanged)));

        private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var button = d as RadSplitButton;
            button.IsToggle = true;
            button.Loaded += Button_Loaded;
            button.Checked += SplitButton_Checked;
            button.Unchecked += SplitButton_Unchecked;
            button.DropDownOpened += Button_DropDownOpened;
            button.DropDownClosed += Button_DropDownClosed;
        }

        private static void Button_Loaded(object sender, RoutedEventArgs e)
        {
            var splitButton = sender as RadSplitButton;
            var colorSelector = splitButton.DropDownContent as RadColorSelector;
            colorSelector.Loaded += (s, a) =>
            {
                var rootElement = colorSelector.ChildrenOfType<Grid>().First(x => x.Name == "RootElement");
                Grid.SetRow(rootElement.Children[1], 4);
                Grid.SetRow(rootElement.Children[2], 5);
                Grid.SetRow(rootElement.Children[3], 6);
                Grid.SetRow(rootElement.Children[4], 1);
                Grid.SetRow(rootElement.Children[5], 2);
                Grid.SetRow(rootElement.Children[6], 3);
            };

            var dropDownPart = splitButton.ChildrenOfType<RadToggleButton>().First(x => x.Name == "DropDownPart");
            var rectangle = splitButton.ChildrenOfType<Rectangle>().First(x => x.Name == "Separator");
            //System.InvalidOperationException: 'Sequence contains no matching element'
            dropDownPart.Visibility = Visibility.Collapsed;
            rectangle.Visibility = Visibility.Collapsed;
        }

        private static void Button_DropDownClosed(object sender, RoutedEventArgs e)
        {
            var splitButton = sender as RadSplitButton;
            splitButton.IsChecked = false;
        }

        private static void Button_DropDownOpened(object sender, RoutedEventArgs e)
        {
            var splitButton = sender as RadSplitButton;
            splitButton.IsChecked = true;
        }

        private static void SplitButton_Checked(object sender, RoutedEventArgs e)
        {
            var splitButton = sender as RadSplitButton;
            var colorPicker = splitButton.ParentOfType<RadColorPicker>();
            colorPicker.IsDropDownOpen = true;
        }

        private static void SplitButton_Unchecked(object sender, RoutedEventArgs e)
        {
            var splitButton = sender as RadSplitButton;
            var colorPicker = splitButton.ParentOfType<RadColorPicker>();
            colorPicker.IsDropDownOpen = false;
        }
    }



 

 

Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
 answered on 30 Apr 2021
1 answer
200 views

how to display image from arcgis server which provider i have to used ?

i want display one image not many tiles from arcgis server 

a)tilemadsource,

b)imagemapsource,

c)UriImageProvider

d)another?

please i want a code.

Petar Mladenov
Telerik team
 answered on 29 Apr 2021
1 answer
173 views

I want to display attached properties in PropertyGrid.

 

How to.

 

 

Martin Ivanov
Telerik team
 answered on 29 Apr 2021
3 answers
437 views
Hi,

I have a RadGridView with a large number of columns which are bound to decimal values. Currently when you sort the columns null values are always sorted to have lowest value.

However, our client would like for nulls to always be sorted to the end of the list when the column is sorted in both ascending and descending modes.

I was wondering if there was a way to achieve this with having to do something for each column individually?

Thanks,

Steven
Peter
Top achievements
Rank 1
Iron
Iron
 answered on 29 Apr 2021
1 answer
209 views

Hi there,

I select the complete text of my RadRichTextBox by code and also want to show the Selection Mini Tool Bar also by code?
Any ideas how to do so?

Actual this only shows up when the selection was done by mouse.

Thank you, Andi

Dimitar
Telerik team
 answered on 29 Apr 2021
0 answers
178 views

Dear sir,

I am using the  Rad Cartesian Chart control in my project.

ItemSource is bounded to a Chart Data that is an Observable Collection.

The value X value (Category ) is the time and Y is value of the data (element that is set to sinuses )

The Chart Data is cleared every 20 sec - a cycle and the new data is add from time=0  re-plotting.

In some scenarios  (Such as dragging of an element on screen) an additional  series is plotted where  y= const. 

Once the cycle is competed all lines are cleared and a new plot starts with no problem. 

 Adding values to Chart Data and clearing it is all by the UI thread. 

Do you have a idea for what may cause this?

I am attaching screen shots hope this will c

Thank you,

Harel Sarit

Hen
Top achievements
Rank 1
Veteran
 asked on 29 Apr 2021
1 answer
424 views

Hello,

Issue when adding columns and aggregate functions programmatically. Version 2019.2

The Group Footer aggregate function works as expected, but when I try to add formatting, it fails.

e.g. if the sum total is 100, the value in the footer appears as "N"

I've tried different format strings - always the same result - what am I doing wrong ?

var c = new GridViewDataColumn
                {
                    Header = columnField.ColumnHeader,
                    MinWidth = 100,
                    DataMemberBinding = new Binding(columnField.ColumnName) { StringFormat = columnField.FormatString },
                    UniqueName = columnField.ColumnName
                };

var sumFunction = new SumFunction() { SourceFieldType = Type.GetType("System.Decimal"), ResultFormatString="N" };

c.AggregateFunctions.Add(sumFunction);

 

 

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 29 Apr 2021
7 answers
313 views

Hello,

I'm using your provided method to manipulate the connector positions in MVVM:

https://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/raddiagrams-mvvm#bind-the-source-and-target-connector-positions-of-the-connection

In my RadDiagram, I am using the RoutedConnections-Property for the auto routing mechanism as described here:

https://docs.telerik.com/devtools/wpf/controls/raddiagram/features/routing

With the OrgTreeRouter:

var router = new OrgTreeRouter()
{
     TreeLayoutType = TreeLayoutType.TreeRight,
     ConnectionOuterSpacing = 20,
};
_ctlDiagram.RoutingService.Router = router;

 

I am setting the Route-Property for the specific RadDiagramConnection to False, but nothing happens...

Only if I disable the RoutedConnections-Property, I can achieve the behaviour I want, but then the connections are no longer routed at all.

I attach two screenshots to help you to understand my issue.

Can you help me with that?

regards,

Tobias

Petar Mladenov
Telerik team
 answered on 28 Apr 2021
1 answer
120 views

in order to allow the user select the text in the select box and copy it to his clipboard. 

We're having a problem that the text cleans up immediately after selection

the code look like:

<telerik:RadComboBox SelectedItem="{Binding ...}" DisplayMemberPath="Name" IsEditable="True"

SelectAllTextEvent="GotFocus" isTextSearchEnabled="False"...>

We try to change SelectAllTextEvent="GotFocus" to SelectAllTextEvent="None"

But that did not solve the problem.

 

Dinko | Tech Support Engineer
Telerik team
 answered on 28 Apr 2021
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?