Public Shared ReadOnly Property Instance As IGridOptionsEnvironment
public static IGridOptionsEnvironment Instance {get;}
Public Shared ReadOnly Property Instance As IGridOptionsEnvironment
public static IGridOptionsEnvironment Instance {get;}
{
GridOptionsEnvironment.Instance.ShowGrid = !GridOptionsEnvironment.Instance.ShowGrid;
}
{
QueuedTask.Run(() =>
{
//Does the 'map' currently have any options?
var hasOptions = GridOptionsEnvironment.Instance.HasGridOptions(map);
//If grid options have not been set for the map, then default grid options are added
//for the map otherwise the existing gridoptions are returned.
//NOTE: Grid options are returned by value meaning a copy is always returned. Any changes made to the
//grid options need to be -set- back on the map using SetGridOptions for the changes to persist.
var gridOptions = GridOptionsEnvironment.Instance.GetGridOptions(
MapView.Active.Map);
//Only return grid options if grid options have previously been set:
var gridOptions2 = GridOptionsEnvironment.Instance.GetGridOptions(
MapView.Active.Map, false);
});
}
{
//assume
//var map = MapView.Active.Map;
QueuedTask.Run(() =>
{
//If grid options have not been set for the map, then default grid options are added
//for the map and returned otherwise the existing gridoptions are returned.
//NOTE: Grid options are by value meaning a copy is returned. Any changes made to the
//grid options need to be -set- back on the map using SetGridOptions for the changes to persist.
var gridOptions = GridOptionsEnvironment.Instance.GetGridOptions(map);
//change some properties
gridOptions.RotateWithMap = !gridOptions.RotateWithMap;
gridOptions.GridLineColor = ColorFactory.Instance.RedRGB;
gridOptions.GridLineColor = ColorFactory.Instance.BlueRGB;
//To apply changes, the gridoptions must be set back on the map
GridOptionsEnvironment.Instance.SetGridOptions(map, gridOptions);
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)