I am building a WPF application in which I am getting an error as
Unable to cast object of type \'MS.Internal.NamedObject\' to type \'System.Windows.
I'm pretty sure your bindings are incorrect. When you perform a binding inside a CellTemplate
you're actually binding to the cell's DataContext rather than your view's DataContext (i.e the viewmodel).
You should try modifying your bindings to take the values from your viewmodel, like this for example:
<Binding Path="DataContext.TickImage" RelativeSource="{RelativeSource AncestorType=DataGrid}" />