Fred,
Yes, if 2 columns are different, only the 2nd works, the reason is that the “TextStyle” is “Reference Type”, instead of “Value Type”. From my experience, I suggest creating different instance of “TextStyle” for different shape files, it decreases the risk of the application, it also simplify the complex of application maintenance. “TextStyle” is not a big object, better that avoiding too many global variables in an application.
Here is an option of only creating 1 copy of TextStyle, but use it for more than 1 layer. However, it doesn’t work as expected in WPF. Here are some codes:
majorCitiesShapeLayer.DrawingFeatures += MajorCitiesShapeLayer_DrawingFeatures;
majorCitiesShapeLayer.FeatureSource.GettingFeaturesByIds += majorCitiesFeatureSource_GettingFeaturesByIds;
In the 2 events, we can change the drawing column as expected:
private void majorCitiesFeatureSource_GettingFeaturesByIds(object sender, GettingFeaturesByIdsFeatureSourceEventArgs e)
{
e.ReturningColumnNames.Add("NAME");
}
private void MajorCitiesShapeLayer_DrawingFeatures(object sender, DrawingFeaturesEventArgs e)
{
e.DrawingZoomLevel.DefaultTextStyle.TextColumnName = "NAME";
}
Very sorry for the inconvenience. Please try creating different instances temporarily.
Thanks,
Johnny