Home Forums WPF controls Xceed DataGrid for WPF grid combobox

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24328 |

    Is there a way to enable the auto complete for a combobox in xceed grid?

    Imported from legacy forums. Posted by dalia (had 940 views)

    Xceed Support
    Member
    Post count: 5658

    Any combobox can be used as an editor for the grid. Once you have configured your combobox, you can assign it to a column’s CellEditor property.

    Refer to the Basic Concepts\Editing Data\Custom Cell Editors topic for more information.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 299 views)

    User (Old forums)
    Member
    Post count: 23064

    what I mean is instead of selecting a value, just type the selected value.

    Imported from legacy forums. Posted by dalia (had 363 views)

    Xceed Support
    Member
    Post count: 5658

    If the combobox you are using supports it, then yes.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 306 views)

    User (Old forums)
    Member
    Post count: 23064

    I am using the one the xceed samples are using, does it support the autocomplete feature, it is not in the samples.

    Imported from legacy forums. Posted by dalia (had 584 views)

    Xceed Support
    Member
    Post count: 5658

    The combobox used in the samples is the one provided my Microsoft <a href=”http://msdn2.microsoft.com/en-us/library/system.windows.controls.combobox.aspx”>(System.Windows.Controls.ComboBox)</a&gt;.

    After checking the combobox, I have found that the <a href=”http://msdn2.microsoft.com/en-us/library/system.windows.controls.itemscontrol.istextsearchenabled.aspx”>IsTextSearchEnabled</a&gt; property is probably what you are looking for.

    So, create an instance of the System.Windows.Controls.ComboBox, set its IsTextSearchEnabled property to true, and then assign the combobox to the CellEditor property of the column in which you want to use it.

    <code>
    ….
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=ShipCountry>
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <ComboBox ….
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>
    </xcdg:Column.CellEditor>
    </xcdg:Column FieldName=ShipCountry>
    </xcdg:DataGridControl.Columns>
    ….
    </code>

    Imported from legacy forums. Posted by Jenny [Xceed] (had 505 views)

    User (Old forums)
    Member
    Post count: 23064

    First I want to thank you for your help, I appriciate it.
    my grid is autopopulated so I don’t define the coulmns, I tried to set the isTextSearchEnabled at the cellEditor part but nothing happened.

    Imported from legacy forums. Posted by dalia (had 486 views)

    User (Old forums)
    Member
    Post count: 23064

    If you want to be able type in combobox, you need to turn on IsEditable as well. But it will not validate against items in the list.

    Imported from legacy forums. Posted by nat (had 626 views)

    User (Old forums)
    Member
    Post count: 23064

    I turned it on but still can’t type at all in the box???

    Imported from legacy forums. Posted by dalia (had 563 views)

    User (Old forums)
    Member
    Post count: 23064

    How did you bind your data?
    1. You need to make it two way binding
    2. You need to define ComboBox in editor template
    3. ComboBox need to have ItemsSource or Items defined properly

    Imported from legacy forums. Posted by nat (had 612 views)

    User (Old forums)
    Member
    Post count: 23064

    How can I make it two way binding? the items Source are fine I get the correct list.
    thanks a lot for your help.

    here is my code
    <!–A data template that will be used to represent a CCY with its name–>
    <DataTemplate x:Key=”ccyDataTemplate”>
    <TextBlock Text=”{Binding ccy}”
    TextTrimming=”{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentColumn.TextTrimming}”
    TextWrapping=”{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentColumn.TextWrapping}”/>
    </DataTemplate>

    <!–A cell content template that will be used to represent a CCY with its name–>
    <DataTemplate x:Key=”ccyCellDataTemplate”>
    <local:CCYDictionary Key=”{TemplateBinding Content}”
    ContentTemplate=”{StaticResource ccyDataTemplate}”>
    </local:CCYDictionary>
    </DataTemplate>

    <!–A cell editor that will be used to edit a CCY column with a combo box–>
    <xcdg:CellEditor x:Key=”ccyEditor”>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <ComboBox BorderThickness=”0″
    Background=”Transparent”
    Foreground=”{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(TextElement.Foreground)}”
    VerticalContentAlignment=”Top”
    SelectedValuePath=”ccy”
    ItemsSource=”{Binding Source={x:Static Application.Current},Path=CCY}”
    ItemTemplate=”{StaticResource ccyDataTemplate}”
    IsEditable=”true”
    IsTextSearchEnabled =”true”
    TextSearch.TextPath=”ccy”
    SelectedValue=”{xcdg:CellEditorBinding}”>
    <ComboBox.Resources>
    <Style TargetType=”Popup”>
    <Setter Property=”TextElement.Foreground”
    Value=”{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}” />
    </Style>
    </ComboBox.Resources>
    </ComboBox>
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    <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>

    Imported from legacy forums. Posted by dalia (had 559 views)

    User (Old forums)
    Member
    Post count: 23064

    It is working now, thanks for all of your help.

    Imported from legacy forums. Posted by dalia (had 7884 views)

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.