User (Old forums)MemberJune 18, 2007 at 2:07 pmPost count: 23064
I have a DTo that I’m using the data grid on that contains 2 related fields. The intent is to display a checkbox for the one field based on the value of the other.
I have this working using a custom CellContentTemplateSelector. the issue I’m having is that when you check the checkbox the value is no longer being updated on the underlying DTO.
Please advise to what I’ve done wrong, or what I’m missing…
Here is my C# code for creating the Column and custom DataTemplateSelector.
Thanks in advance…
private void CreatePostColumn()
Column postColumn = new Column();
postColumn.FieldName = “Post”;
postColumn.Title = “Post”;
postColumn.CellContentTemplateSelector = new PostSelector();
Binding binding = new Binding(“.”);
binding.Mode = BindingMode.TwoWay;
postColumn.DisplayMemberBinding = binding;
internal class PostSelector : DataTemplateSelector
public override DataTemplate SelectTemplate(object item, DependencyObject container)
DataTemplate emptyTempate = new DataTemplate();
MyDTO dto = item as MyDTO ;
if (dto == null || dto.Status.Equals(StatusType.Success))
DataTemplate checkboxTemplate = new DataTemplate();
FrameworkElementFactory checkbox =
new FrameworkElementFactory( typeof( CheckBox ) );
checkboxTemplate.VisualTree = checkbox;
Imported from legacy forums. Posted by Greg (had 2503 views)Xceed SupportMemberJune 19, 2007 at 8:44 amPost count: 5658
The CellContentTemplate should not be used to attempt “modifying” the Cell’s Content…
Effectivelly, the DataContext of the DataTemplate might be the “Content” but changes to the DataContext are not repercuted to the ContentProperty (it’s only the DataContext that changes)…
This is the reason why we came up with the CellEditor.EditTemplate which should be using the “CellEditorBinding” Markup Extension to achieve the proper “edition” binding.
Imported from legacy forums. Posted by Marcus [Xceed] (had 352 views)User (Old forums)MemberJune 19, 2007 at 11:59 amPost count: 23064
thanks for the Feedback.
What I need then is to be able to dynamically assign an EditTemplate based on the value of another cell on the same row. Do you have a C# code example of that. I’ll take a XAML example in the absense of a C# example.
Imported from legacy forums. Posted by Greg (had 3598 views)
- You must be logged in to reply to this topic.