Unable to handle MyToolKit.Extended DataGrid in UWP
<p>I am developing a <strong>UWP</strong> application. 
Here I want to show data in a table formate like below,</p>

<p><a href="https://i.stack.imgur.com/lF2Ks.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lF2Ks.png" alt="enter image description here"></a></p>

<p>Here my purpose is I will search items and add those to this grid.
with out data in grid If I click on <strong>Rounded button(Red Color it's a datagrid Header template )</strong> its working fine , but if grid contains some data in that case if I click on Rounded Image Button getting unhand-led Exception like ,</p>

<p><a href="https://i.stack.imgur.com/b6zCM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b6zCM.png" alt="enter image description here"></a>  </p>

<p>Here I am placing the code which I have used,</p>

<pre><code>&lt;controls:DataGrid x:Name="dgNewBill" Grid.Row="0" Grid.Column="0" MinHeight="500" HorizontalAlignment="Left" HeaderBackground="Black"  DefaultOrderIndex="1" Background="Black" RowBackgroundEvenBrush="Black" RowBackgroundOddBrush="Black" &gt;
                                &lt;controls:DataGrid.RowStyle&gt;
                                    &lt;Style TargetType="ListBoxItem"&gt;
                                        &lt;Setter Property="Padding" Value="0"&gt;&lt;/Setter&gt;
                                        &lt;Setter Property="HorizontalAlignment" Value="Stretch"&gt;&lt;/Setter&gt;
                                    &lt;/Style&gt;
                                &lt;/controls:DataGrid.RowStyle&gt;

                                &lt;controls:DataGrid.Columns&gt;
                                    &lt;controls:DataGridTextColumn Width="50" Binding="{Binding SNumber}" Foreground="White"
                     IsAscendingDefault="False" CanSort="False"&gt;
                                        &lt;controls:DataGridTextColumn.Header&gt;
                                            &lt;Button x:Uid="RSNO" Height="40"  Width="50" HorizontalAlignment="Left" Style="{StaticResource RoundButtonTemplate}" Margin="-10,0,0,0"/&gt;
                                        &lt;/controls:DataGridTextColumn.Header&gt;
                                        &lt;controls:DataGridTextColumn.Style&gt;
                                            &lt;Style TargetType="TextBlock"&gt;
                                                &lt;Setter Property="TextAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                            &lt;/Style&gt;
                                        &lt;/controls:DataGridTextColumn.Style&gt;
                                    &lt;/controls:DataGridTextColumn&gt;

                                    &lt;!--Item Column--&gt;
                                    &lt;controls:DataGridTextColumn Width="380" Binding="{Binding description}" Foreground="White" CanSort="False"&gt;
                                        &lt;controls:DataGridTextColumn.Header&gt;
                                            &lt;Button x:Uid="RItem"  Height="40" Width="380"   Style="{StaticResource RoundButtonTemplate}"  Margin="-12,0,0,0"/&gt;
                                        &lt;/controls:DataGridTextColumn.Header&gt;
                                        &lt;controls:DataGridTextColumn.Style&gt;
                                            &lt;Style TargetType="TextBlock"&gt;
                                                &lt;Setter Property="TextAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                            &lt;/Style&gt;
                                        &lt;/controls:DataGridTextColumn.Style&gt;
                                    &lt;/controls:DataGridTextColumn&gt;
                                    &lt;!--UOM column--&gt;
                                    &lt;controls:DataGridTextColumn Width="120" Binding="{Binding uom}" Foreground="White" CanSort="False"&gt;
                                        &lt;controls:DataGridTextColumn.Header&gt;
                                            &lt;Button x:Uid="RUOM" Height="40" Width="120"  Style="{StaticResource RoundButtonTemplate}"  Margin="-12,0,0,0"/&gt;
                                        &lt;/controls:DataGridTextColumn.Header&gt;
                                        &lt;controls:DataGridTextColumn.Style&gt;
                                            &lt;Style TargetType="TextBlock"&gt;
                                                &lt;Setter Property="TextAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                            &lt;/Style&gt;
                                        &lt;/controls:DataGridTextColumn.Style&gt;
                                    &lt;/controls:DataGridTextColumn&gt;
                                    &lt;!--Price Column--&gt;
                                    &lt;controls:DataGridTemplatedColumn&gt;
                                        &lt;controls:DataGridTemplatedColumn.Header&gt;
                                            &lt;Button x:Uid="RPrice" Height="40" Width="110"  Style="{StaticResource RoundButtonTemplate}"  Margin="-12,0,0,0"/&gt;
                                        &lt;/controls:DataGridTemplatedColumn.Header&gt;
                                        &lt;controls:DataGridTemplatedColumn.CellTemplate&gt;
                                            &lt;DataTemplate&gt;
                                                &lt;StackPanel Name="pricePanel" Width="110" Height="30" Tapped="pricePanel_Tapped" &gt;
                                                    &lt;TextBlock Name="price" Foreground="White"  Text='{Binding price}' VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,0"&gt;&lt;/TextBlock&gt;
                                                &lt;/StackPanel&gt;
                                            &lt;/DataTemplate&gt;
                                        &lt;/controls:DataGridTemplatedColumn.CellTemplate&gt;
                                    &lt;/controls:DataGridTemplatedColumn&gt;


                                     &lt;!--Qty Column--&gt;
                                    &lt;controls:DataGridTemplatedColumn&gt;
                                        &lt;controls:DataGridTemplatedColumn.Header&gt;
                                            &lt;Button x:Uid="RQty" Height="40" Width="110"  Style="{StaticResource RoundButtonTemplate}"  Margin="-25,0,0,0"/&gt;
                                        &lt;/controls:DataGridTemplatedColumn.Header&gt;
                                        &lt;controls:DataGridTemplatedColumn.CellTemplate&gt;
                                            &lt;DataTemplate&gt;
                                                &lt;StackPanel Name="quantityPanel" Width="50" Height="30" Tapped="quantityPanel_Tapped"&gt;
                                                    &lt;TextBlock Name="quantity" Foreground="White"  Text='{Binding quantity}' VerticalAlignment="Center" Margin="0,5,0,0"&gt;&lt;/TextBlock&gt;
                                                &lt;/StackPanel&gt;
                                            &lt;/DataTemplate&gt;
                                        &lt;/controls:DataGridTemplatedColumn.CellTemplate&gt;
                                    &lt;/controls:DataGridTemplatedColumn&gt;

                                    &lt;!--Discount Column--&gt;
                                    &lt;controls:DataGridTemplatedColumn&gt;
                                        &lt;controls:DataGridTemplatedColumn.Header&gt;
                                            &lt;Button x:Uid="Rdiscount" Height="40" Width="60"  Style="{StaticResource RoundButtonTemplate}"  Margin="-25,0,0,0"/&gt;
                                        &lt;/controls:DataGridTemplatedColumn.Header&gt;
                                        &lt;controls:DataGridTemplatedColumn.CellTemplate&gt;
                                            &lt;DataTemplate&gt;
                                                &lt;StackPanel Name="discountPanel" Width="60" Height="30" Tapped="discountPanel_Tapped" &gt;
                                                    &lt;TextBlock Name="Discount" Foreground="White" Text='{Binding discount}' VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,0"&gt;&lt;/TextBlock&gt;
                                                &lt;/StackPanel&gt;
                                            &lt;/DataTemplate&gt;
                                        &lt;/controls:DataGridTemplatedColumn.CellTemplate&gt;
                                    &lt;/controls:DataGridTemplatedColumn&gt;

                                    &lt;!--Cost Column--&gt;
                                    &lt;controls:DataGridTextColumn Width="110" Binding="{Binding cartTotal}" Foreground="White" CanSort="False" &gt;
                                        &lt;controls:DataGridTextColumn.Header&gt;
                                            &lt;Button x:Uid="RCartTotal" Height="40" Width="110"   Style="{StaticResource RoundButtonTemplate}"  Margin="-25,0,0,0"/&gt;
                                        &lt;/controls:DataGridTextColumn.Header&gt;
                                        &lt;controls:DataGridTextColumn.Style&gt;
                                            &lt;Style TargetType="TextBlock"&gt;
                                                &lt;Setter Property="TextAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                            &lt;/Style&gt;
                                        &lt;/controls:DataGridTextColumn.Style&gt;
                                    &lt;/controls:DataGridTextColumn&gt;

                                &lt;!--void image column--&gt;
                                    &lt;controls:DataGridTemplatedColumn&gt;
                                        &lt;controls:DataGridTemplatedColumn.Header&gt;
                                            &lt;Button Name="Cancelbtn" Height="50" Click="Cancelbtn_Click" Width="55" &gt;
                                                &lt;Image Source="/Images/erase.png"  Name="ImgClearCartp" Height="40" Width="40" &gt;&lt;/Image&gt;
                                            &lt;/Button&gt;
                                        &lt;/controls:DataGridTemplatedColumn.Header&gt;
                                        &lt;controls:DataGridTemplatedColumn.CellTemplate&gt;
                                            &lt;DataTemplate&gt;
                                                &lt;StackPanel Name="voidImagePanel" Width="50" Height="30" Tapped="voidImagePanel_Tapped" &gt;
                                                    &lt;Image Name="VoidImage" Source='{Binding imageUrl}' Height="20" Width="30" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"&gt;&lt;/Image&gt;
                                                &lt;/StackPanel&gt;
                                            &lt;/DataTemplate&gt;
                                        &lt;/controls:DataGridTemplatedColumn.CellTemplate&gt;
                                    &lt;/controls:DataGridTemplatedColumn&gt;
                                &lt;/controls:DataGrid.Columns&gt;
                            &lt;/controls:DataGrid&gt;
</code></pre>

<p>I have tested and according to my understanding, because of using <strong>DataGridTemplatedColumn</strong> getting this exception. But according to my scope I have to use TemplateColumn instead of <strong>DataGridTextColumn</strong>.</p>

<p>And I have used <a href="https://github.com/MyToolkit/MyToolkit/wiki/DataGrid" rel="nofollow noreferrer">https://github.com/MyToolkit/MyToolkit/wiki/DataGrid</a></p>

<p>link.
<strong>Please suggest me how can I solve this issue?</strong></p>