Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid>
    <WindowsFormsHost Height="176" HorizontalAlignment="Left" Margin="33,102,0,0" Name="symbologyHost" VerticalAlignment="Top" Width="201" />
</Grid>

And in the code behind page:

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

        _axSymbologyControl.CreateControl();

        _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.GetStyleClass(_axSymbologyControl.StyleClass).SelectItem(0);

        _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.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.