Skip to content
In this sample we show you how to render points with textStyle in your WPF applications. It is using ThinkGeo Web Font which can be browsed/downloaded from Here. This sample uses ThinkGeo UI for Wpf 12.0.12 or higher. TextStyle can render a point layer with font glyphs, it can also take advantage of the text confliction check to avoid duplicatio…
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
RenderPointWithTextStyle-ForWpf.NETCore
.gitignore
README.md
RenderPointWithTextStyle-ForWpf.NETCore.sln
Screenshot.gif

README.md

Render Point With TextStyle for Wpf

Description

In this sample we show you how to render points with textStyle in your WPF applications. It is using ThinkGeo Web Font which can be browsed/downloaded from Here. This sample uses ThinkGeo UI for Wpf 12.0.12 or higher.

TextStyle can render a point layer with font glyphs, it can also take advantage of the text confliction check to avoid duplication. PointClusterStyle can also be used to remove duplication, and here is a sample of it.

Screenshot

About the Code

The sample is rendering the points from FriscoSchools.shp. One thing needs to be aware of: Column name is required for grabbing the corresponding attributes for each record in the shapefile. Here we pass in a column ("textColumn") which doesn't exist in the data, that raises CustomColumnFetch event in which we can simply return the glyph content we are going to draw for each feature.

    ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer("AppData/FriscoSchools.shp");
    // CustomColumnFetch event is raised every time the layer is fetching a column which doesn't exist. 
    // In this example as "textColumn" does not exist in the shape file, CustomColumnFetch event 
    // will be raised so give us a way to programmatically filling it in.  
    shapeFileFeatureLayer.FeatureSource.CustomColumnFetch += FeatureSource_CustomColumnFetch;

    // Use a font glyph to render a point. 
    // This font in the sample can be downloaded at https://thinkgeo.com/map-icons-webfont.
    GeoFont geoFont = new GeoFont("AppData/vectormap-icons.ttf", 20);
    TextStyle textStyle = new TextStyle("textColumn", geoFont, GeoBrushes.Yellow);
   
    // "textColumn" doesn't exist in the shape file, this is why CustomColumnFetch is raised.
    shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle);
    shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

    private void FeatureSource_CustomColumnFetch(object sender, CustomColumnFetchEventArgs e)
    {
        // "\ue0aa" is the school zone glyph content in ThinkGeo Web Font. 
        // Visit https://thinkgeo.com/map-icons-webfont and you can find more glyph icons from ThinkGeo. 
        e.ColumnValue = "\ue0aa";
    }

Getting Help

ThinkGeo Desktop for Wpf Wiki Resources

ThinkGeo Desktop for Wpf Product Description

ThinkGeo Community Site

ThinkGeo Web Site

About ThinkGeo

ThinkGeo is a GIS (Geographic Information Systems) company founded in 2004 and located in Frisco, TX. Our clients are in more than 40 industries including agriculture, energy, transportation, government, engineering, software development, and defense.

You can’t perform that action at this time.