Reference to DataTemplated UI object in Datagrid /BUG

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
Sesztak
Posts: 172
Joined: Fri Jun 24, 2016 2:19 am

Reference to DataTemplated UI object in Datagrid /BUG

Postby Sesztak » Mon Sep 19, 2016 5:32 am

Dear JS-Support,

We have an easy task: to change some properties of the SelectedItem under DataTemplated UI object in Datagrid => .
So, we need reference (C# code behind) to UI element under DataTemplate.

In WPF it works like:
var _Container = datagrid.ItemContainerGenerator
.ContainerFromItem(datagrid.SelectedItem);

In CSHTML we got null value of _Container during debbugging:

_Container = null

Please, double check at your side: can you reproduce the bug ?

Or antoher say: in the meantime is there any workaround to get reference of DataTemplated UI object in Datagrid.
E.g. we would like to set forecolor of TextBlock from Grey to Red in case of Server sent event occur.

Thanks for your kind reply,
Best Regards,
Péter

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 32 guests