Unable to cast object of type 'MS.Internal.NamedObject' to BitmapImage

前端 未结 1 956
时光说笑
时光说笑 2020-12-06 05:54

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.

相关标签:
1条回答
  • 2020-12-06 06:37

    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}" />
    
    0 讨论(0)
提交回复
热议问题