Welcome to the Xceed Community | Help
Community Search  
More Search Options

Manually created columns CellEditor

Sort Posts: Previous Next
  •  03-10-2010, 2:27 PM Post no. 26062

    Manually created columns CellEditor

    Hello,

     Is there any reason why CellEditor won't show up when Columns of grid are created manually? Situation is following: I set EditTrigger on DataGrid, create columns and set CellEditorDisplayConditions, create CellEditor and add it to appropriate column. Once row enters edit mode, CellEditor is not visible. Row is in edit mode, glyph is displayed, and I checked in DataGridCollectionView and data is being edited.

    However, if i set AutoCreateColumns to true, and let DataGrid generate columns, do all the CellEditor stuff, then editors are displayed correctly.

    I use version 3.5 since that is the one my employer has license for, if version has anything to do with this. DataGridCollectionView is created in identical manner, I haven't noticed any differences between columns in debug, except one private property IsBindingAutoCreated. I even tried changing it in debug, but that didn't change anything.

     

     Best regards,

    Nikola

  •  03-10-2010, 4:04 PM Post no. 26063 in reply to 26062

    Re: Manually created columns CellEditor

    Hi Nikola,

    Probably, the CellEditor’s EditTemplate of the column manually created was not properly implemented or set.  Please note that the Xceed DatagridControl will use default editor based on the field’s DataType if available.

    Implementation examples are available on the Included Editors available on the folder: C:\Xceed Samples\Xceed DataGrid for WPF v3.6\CSharp\IncludedEditors.

     

    For example:

    <xcdg:Column FieldName="Category"

                             Title="ComboBox"

                             Width="125"

                             CellContentTemplate="{StaticResource categoryCellDataTemplate}"

                             CellEditor="{StaticResource categoryEditor}"

                             Visible="{Binding Source={x:Static local:MainPageParams.Singleton},Path=ComboBoxColumnsVisible}" />

    With

    <xcdg:CellEditor x:Key="categoryEditor">

          <xcdg:CellEditor.EditTemplate>

             <DataTemplate>

                <ComboBox BorderThickness="0"

                          VerticalContentAlignment="Top"

                          MinHeight="22"

                          ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType=local:MainPage},Path=Departments}"

                          SelectedValue="{xcdg:CellEditorBinding}"

                          FocusVisualStyle="{x:Null}">

                   <ComboBox.Resources>

                      <Style TargetType="Popup">

                         <Setter Property="TextElement.Foreground"

                                 Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

                      </Style>

                   </ComboBox.Resources>

                </ComboBox>

             </DataTemplate>

          </xcdg:CellEditor.EditTemplate>

     

          <!-- Declare the wanted key gesture that will activate the ComboBox CellEditor. -->

          <xcdg:CellEditor.ActivationGestures>

             <xcdg:KeyActivationGesture SystemKey="Down"

                                        Modifiers="Alt" />

             <xcdg:KeyActivationGesture Key="Up"

                                        Modifiers="Alt" />

             <xcdg:KeyActivationGesture Key="F4" />

             <xcdg:KeyActivationGesture Key="Space" />

          </xcdg:CellEditor.ActivationGestures>

       </xcdg:CellEditor>

     


    Xceed - Software Developer and Technical Support
  •  03-10-2010, 5:37 PM Post no. 26067 in reply to 26063

    Re: Manually created columns CellEditor

    Hi Mohamed,

    thanks for your reply. I found cause of my problem (after entire day unfortunately) if someone needs it. When dynamically creating columns, CellEditors wont appear if you use

    CellEditor(string, string, Binding) constructor.

    Maybe it would work with some kind of XCeed internal Binding extension.

    Best regards,

    Nikola

    -------------------------------------------

    EDIT: I have to correct myself. You can use the constructor, but then pass null as Binding.

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.