public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(value is SymbolTemplate))
            {
                return(value);
            }

            SymbolTemplate symbolTemplate = value as SymbolTemplate;

            if (symbolTemplate.Symbol == null)
            {
                return(null);
            }
            Symbol convertedSymbol = symbolTemplate.Symbol;

            if (symbolTemplate.FeatureTemplate == null)
            {
                return(convertedSymbol);
            }

            FeatureTemplate featureTemplate = symbolTemplate.FeatureTemplate;

            if (symbolTemplate.Symbol is FSSymbols.SimpleFillSymbol ||
                symbolTemplate.Symbol is FSSymbols.PictureFillSymbol ||
                symbolTemplate.Symbol is FSSymbols.SimpleLineSymbol)
            {
                switch (featureTemplate.DrawingTool)
                {
                case FeatureEditTool.Polygon:
                    convertedSymbol = new PolygonSymbol();
                    break;

                case FeatureEditTool.AutoCompletePolygon:
                    convertedSymbol = new AutoCompletePolygonSymbol();
                    break;

                case FeatureEditTool.Circle:
                    convertedSymbol = new CircleSymbol();
                    break;

                case FeatureEditTool.Ellipse:
                    convertedSymbol = new EllipseSymbol();
                    break;

                case FeatureEditTool.Rectangle:
                    convertedSymbol = new RectangleSymbol();
                    break;

                case FeatureEditTool.Freehand:
                    if (symbolTemplate.Symbol is FSSymbols.SimpleLineSymbol)
                    {
                        convertedSymbol = new FreehandLineSymbol();
                    }
                    else
                    {
                        convertedSymbol = new FreehandPolygonSymbol();
                    }
                    break;

                case FeatureEditTool.Line:
                    convertedSymbol = new PolylineSymbol();
                    break;
                }

                if (convertedSymbol is ShapeMarkerSymbol)
                {
                    ShapeMarkerSymbol shapeMarkerSymbol = convertedSymbol as ShapeMarkerSymbol;
                    FillMarkerSymbol  fillMarkerSymbol  = convertedSymbol as FillMarkerSymbol;
                    if (symbolTemplate.Symbol is FSSymbols.SimpleFillSymbol)
                    {
                        ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleFillSymbol simpleFillSymbol =
                            symbolTemplate.Symbol as FSSymbols.SimpleFillSymbol;
                        fillMarkerSymbol.Stroke          = simpleFillSymbol.BorderBrush;
                        fillMarkerSymbol.Fill            = simpleFillSymbol.Fill;
                        fillMarkerSymbol.StrokeStyle     = simpleFillSymbol.BorderStyle;
                        fillMarkerSymbol.StrokeThickness = simpleFillSymbol.BorderThickness;
                        shapeMarkerSymbol.SelectionColor = simpleFillSymbol.SelectionColor;
                    }
                    else if (symbolTemplate.Symbol is FSSymbols.PictureFillSymbol)
                    {
                        ESRI.ArcGIS.Client.FeatureService.Symbols.PictureFillSymbol pictureFillSymbol =
                            symbolTemplate.Symbol as FSSymbols.PictureFillSymbol;
                        fillMarkerSymbol.Stroke          = pictureFillSymbol.BorderBrush;
                        fillMarkerSymbol.StrokeStyle     = pictureFillSymbol.BorderStyle;
                        fillMarkerSymbol.StrokeThickness = pictureFillSymbol.BorderThickness;
                        shapeMarkerSymbol.SelectionColor = pictureFillSymbol.SelectionColor;

                        // Create new image brush for fill in order to set stretch to Uniform
                        ImageBrush brush = new ImageBrush()
                        {
                            Stretch     = Stretch.Uniform,
                            ImageSource = pictureFillSymbol.Source
                        };
                        fillMarkerSymbol.Fill = brush;
                    }
                    else if (symbolTemplate.Symbol is FSSymbols.SimpleLineSymbol)
                    {
                        ESRI.ArcGIS.Client.FeatureService.Symbols.SimpleLineSymbol simpleLineSymbol =
                            symbolTemplate.Symbol as FSSymbols.SimpleLineSymbol;
                        shapeMarkerSymbol.Stroke          = simpleLineSymbol.Color;
                        shapeMarkerSymbol.StrokeStyle     = simpleLineSymbol.Style;
                        shapeMarkerSymbol.StrokeThickness = simpleLineSymbol.Width;
                        shapeMarkerSymbol.SelectionColor  = simpleLineSymbol.SelectionColor;

                        if (fillMarkerSymbol != null)
                        {
                            fillMarkerSymbol.Fill = new SolidColorBrush(Colors.Transparent);
                        }
                    }
                }
            }

            return(convertedSymbol);
        }
        private static BaseSymbol GetSymbolFromType(int objectType, byte symType)
        {
            BaseSymbol bs = null;

            switch (objectType)
            {
                case 1:
                    bs = new PointSymbol();
                    break;
                case 2:
                    if (symType == 0x01)
                        bs = new LineTextSymbol();
                    else
                        bs = new LineSymbol();
                    break;
                case 3:
                    bs = new AreaSymbol();
                    break;
                case 4:
                    bs = new TextSymbol();
                    break;
                case 5:
                    bs = new RectangleSymbol();
                    break;
                default:
                    throw new ApplicationException("Unknown objectType: " + objectType);
            }
            return bs;
        }