AnsweredAssumed Answered

Changing selection color

Question asked by DevonTaig on Jun 8, 2016

I hope this is the right place to post this question.  I'm trying to change the selection color for a layer to red using the code below.  Although I am able to generate a selection, the color for the features ends up being the default color (cyan).

 

foreach (var x in MapView.Active.Map.Layers)

{

    if (x.Name == "Distribution Lines")

    {

        foreach (FeatureLayer fl in ((GroupLayer)x).Layers)

        {

            try

            {

                QueuedTask.Run(() =>

                {

                    CIMBasicFeatureLayer cbm = (CIMBasicFeatureLayer)fl.GetDefinition();

                    cbm.SelectionColor = CIMColor.CreateRGBColor(255, 0, 0);

                    fl.Select(queryFilter, SelectionCombinationMethod.New);

                                   

                });

            }

            catch (Exception ex)

            {

            }

        }

    }

}

Outcomes