Thanks Morten,
My problem is a bit complicated.
Even if offset is used correctly, it does not position the symbol at correct location. This happens only in the case when symbol size (and so the offset) is decided at runtime.
If fixed size symbols and accordingly fixed offset is used, then things work alright.
Code and the symbol definition are mentioned for reference -
Symbol Resource in XAML -
<esriSymbols:MarkerSymbol x:Name="DefaultFLRateSymbol">
<esriSymbols:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Grid Name="flGrd">
<Ellipse Height="{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=SYMBOL_SIZE, Mode=OneWay}"
Width="{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=SYMBOL_SIZE, Mode=OneWay}"
StrokeThickness="2" Fill="#5500FF00" Stroke="Red" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Ellipse Name="innerRadius" Width="5" Height="5" Fill="Black" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</esriSymbols:MarkerSymbol.ControlTemplate>
</esriSymbols:MarkerSymbol>
Code Behind -
//FL layer
Graphic graphicFL = new Graphic()
{
Geometry = graphic.Geometry,
};
//where 'ind' is static double with initial value 0.0
double d = 12.45 + ind;
ind = ind + 1.20;
graphicFl.Attributes["SYMBOL_SIZE"] = d;
MarkerSymbol ms = DefaultFLRateSymbol as MarkerSymbol;
ms.OffsetX = d / 2;
ms.OffsetY = d / 2;
graphicFl.Symbol = DefaultFLRateSymbol;
grLyrFlowRate.Graphics.Add(graphicFl);
If I keep the 'd' as a fixed value then symbols are located at correct location.
In my case symbol size represent some field attribute so need to be dynamic.
Your help is highly appreciated.