Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I'm having a problem with the TreeListControl when I try to define both an EditTemplate and a DisplayTemplate for a given TreeListColumn. When I define both editing and display temaplates, while I the control succesfully toggles between the two, once I am in editing mode I can no longer register key strokes within the control. For instance, while the control successfully switches between a TextBox and a DateEdit when the user clicks inside it, I cannot click on the pull down menu to change the date, or even enter it manually. This behavior effects any kind of control I define in the editing template, not just the DateEdit control. My XAML code is provided below; I've left comments to highlight the trouble area.


                                    Thanks in advance for your help,

                                    Kevin

                                    [C#]
                                    <dxg:TreeListControl Name="gridControl1" Grid.Row="1" AutoPopulateColumns="false"> <dxg:TreeListControl.View> <dxg:TreeListView x:Name="view" DataRowTemplate="{StaticResource routePointTemplate}" DataRowTemplateSelector="{StaticResource Selector}" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childSelector}" KeyDown="view_KeyDown"> <dxg:TreeListView.RowCellMenuCustomizations> <dxb:BarButtonItem Content="Add New Point" ItemClick="BarButtonItem_ItemClick"/> <dxb:BarButtonItem Content="Delete Selected Point" ItemClick="BarButtonItem_ItemClick_1"/> <dxb:BarButtonItem Content="Save Point" /> </dxg:TreeListView.RowCellMenuCustomizations> </dxg:TreeListView> </dxg:TreeListControl.View> <dxg:TreeListControl.Columns> <dxg:TreeListColumn FieldName="Name" Width="100" AllowEditing="True"> <dxg:TreeListColumn.EditTemplate> <ControlTemplate> <dxg:LookUpEdit Text="{Binding Data.Name}" /> </ControlTemplate> </dxg:TreeListColumn.EditTemplate> </dxg:TreeListColumn> <dxg:TreeListColumn FieldName="Address" Width="200" AllowEditing="True"> <dxg:TreeListColumn.EditTemplate> <ControlTemplate> <dxe:TextEdit Text="{Binding Data.Address}"/> </ControlTemplate> </dxg:TreeListColumn.EditTemplate> </dxg:TreeListColumn> <dxg:TreeListColumn FieldName="distance" Header="dist" Width="50" AllowEditing="False" /> <dxg:TreeListColumn Header="Arrive Date" AllowEditing="True"> <!--Region Problem Area--> <dxg:TreeListColumn.EditTemplate> <ControlTemplate> <dxe:DateEdit DateTime="{Binding Data.StartDateTime, Mode=TwoWay}" /> </ControlTemplate> </dxg:TreeListColumn.EditTemplate> <dxg:TreeListColumn.DisplayTemplate> <ControlTemplate> <TextBlock Text="{Binding Data.StartDateTime.Date}" /> </ControlTemplate> </dxg:TreeListColumn.DisplayTemplate> <!-- End Region--> </dxg:TreeListColumn> <dxg:TreeListColumn FieldName="StartDateTime.TimeOfDay" Header="Arrive Time"> <dxg:TreeListColumn.EditTemplate> <ControlTemplate> <local:TimeEdit DateTime="{Binding Data.StartDateTime, Mode=TwoWay}"/> </ControlTemplate> </dxg:TreeListColumn.EditTemplate> </dxg:TreeListColumn> </dxg:TreeListControl.Columns> </dxg:TreeListControl>

                                    

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi,

                                Thank you for your inquiry. The Arrive Date column is not bound with the underlying data. Set the FieldName or DisplayMemberBinding property to do this. I can see that editors within EditTemplate do not have a name. Please set the name to "PART_Editor".

                                Our DXGrid/DXTreeList supports only our editors (in the editing mode), and it is necessary to define them in a special manner:
                                                        <dxg:TreeListColumn.EditTemplate>
                                                            <ControlTemplate>
                                                                <dxe:DateEdit x:Name="PART_Editor" EditValue="{Binding EditValue, RelativeSource={RelativeSource Mode=TemplatedParent}}" EditMode="InplaceActive"/>
                                                            </ControlTemplate>
                                                        </dxg:TreeListColumn.EditTemplate>
                                In this case, DXGrid/DXTreeList will be able to get a cell editor and apply some settings to it. Please refer to the following thread to learn more about it: Hiding default editor for a DateTime column.

                                However, as I can see, you have not applied any special properties to the cell editors. So, I do not quite understand why you need to override EditTemplate. If the TreeList definition in your real application is the same as the one you provided, I suggest you use EditSettings instead of EditTemplate. For instance:
                                                    <dxg:TreeListColumn Header="Arrive Date" AllowEditing="True"> <!--It is necessary to set the FieldName property-->
                                                        <dxg:TreeListColumn.EditSettings>
                                                                <dxe:DateEditSettings/>
                                                        </dxg:TreeListColumn.EditSettings>
                                                        <dxg:TreeListColumn.DisplayTemplate>
                                                            <ControlTemplate>
                                                                <TextBlock Text="{Binding Data.StartDateTime.Date}" />
                                                            </ControlTemplate>
                                                        </dxg:TreeListColumn.DisplayTemplate>
                                                    </dxg:TreeListColumn>

                                Please try the approach with EditSettings and let me know of your results.

                                • Posted by Kevin:

                                  Alexander,
                                      Thanks for your help, I was able to implement you proposed solution using the EditSettings instead of the EditTemplate. The XAML you posted wasn't quite valid, EditSettings does not seem to have a ControlTemplate property, but this worked.

                                  <dxg:TreeListColumn Header="Arrive Date" AllowEditing="True" FieldName="StartDateTime">

                                  <dxg:TreeListColumn.EditSettings>

                                  <dxe:DateEditSettings />

                                  </dxg:TreeListColumn.EditSettings>

                                  <dxg:TreeListColumn.DisplayTemplate>

                                  <ControlTemplate>

                                  <TextBlock Text="{Binding Data.StartDateTime.Date}" />

                                  </ControlTemplate>

                                  </dxg:TreeListColumn.DisplayTemplate>

                                  </dxg:TreeListColumn>

                                  As for your comment on why I needed to overide the editing temaplate: I don't. It was the display template I wanted to customize with a converter on the binding (not shown in the solution above).

                                  Thanks,
                                  -Kevin

                                • Thank you Kevin for this remark and sharing your results. You are right, I had a mistake in my previous answer. I have corrected it.

                                  I am glad to hear that the issue has been resolved. Let me know if you need any further assistance.

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners