I need a way to offer the user a choice of color ramps for the ClassBreaksRenderer. I came across the AxSymbologyControl which was designed for WinForms. I tried also ESRIs (WinForms) example project and it works fine. However, I am building everything with WPF and according to ESRIs documentation one can add a WinForms control like the MapControl with the help of the WindowsFormsHost control. This is what I tried:

<UserControl x:Class="MCDA.VisualizationView"
Height="300" Width="300">
    <WindowsFormsHost Height="176" HorizontalAlignment="Left" Margin="33,102,0,0" Name="symbologyHost" VerticalAlignment="Top" Width="201" />

And in the code behind page:

 private void CreateSymbology()
        _axSymbologyControl = new ESRI.ArcGIS.Controls.AxSymbologyControl();


        _axSymbologyControl.Location = new System.Drawing.Point(8, 16);
        _axSymbologyControl.Size = new System.Drawing.Size(272, 265);

        symbologyHost.Child = _axSymbologyControl;

        //Get the ArcGIS install location
        string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path;

        //Load the ESRI.ServerStyle file into the SymbologyControl
        _axSymbologyControl.LoadStyleFile(sInstall + @"\Styles\ESRI.ServerStyle");

        //Set the style class
        _axSymbologyControl.StyleClass = esriSymbologyStyleClass.esriStyleClassColorRamps;


        _axSymbologyControl.OnItemSelected += new ESRI.ArcGIS.Controls.ISymbologyControlEvents_Ax_OnItemSelectedEventHandler(_axSymbologyControl_OnItemSelected);

The problem is I can't see the control in my window - it is empty. It seems I miss something important.

In case there is a better approach I would like to hear more about it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.