I have the need for a cell to contain a XamTextEditor and a button beside the text editor to do some custom logic. I tried this using a style that changed the CellValuePresenter below but it has a couple of problems.
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="testField"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <StackPanel Orientation="Horizontal"> <igEditors:XamTextEditor Width="{TemplateBinding Width}" Text="{TemplateBinding Content}"> </igEditors:XamTextEditor> <Button Content="..." Click="Button_Click" Margin="2 0 0 0" /> </StackPanel> </ControlTemplate> </Setter.Value> </Setter></Style>
Problem 1: If the editor has no content then the editor width is really small. I would like it to fill the cell.
Problem 2: The EditModeStarting/Started and EditModeEnding/Ended events don't fire for the text editor
Hello,
When you create a custom template for the CellValuePresenter there are some limitaitons about the EditModeStarted and EditModeEnded events.
Please take a look at the following thread for more details :
http://blogs.infragistics.com/blogs/andrew_smith/archive/2009/03/27/hosting-wpf-controls-in-a-xamdatagrid-cell.aspx
In your case I suggest you to create a custom XamTextEditor style and provide Template and EditTemplate for the editor. About the editor's width you can set this in the style :
Width="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ActualWidth }"
Best Regards
Vlad
Developer Support Team