This is a migrated thread and some comments may be shown as answers.

AutoCompleteBox inside RadGrid not working.

5 Answers 176 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Nivid
Top achievements
Rank 2
Nivid asked on 10 Dec 2012, 07:02 PM
I have an autocompletebox inside the RadGridDataColumn as in the CellEditTemplate. When I run the code the It does not work or suggest any  of the items. Instead there are various binding errors in the output window.


                     <tk:GridViewDataColumn DataMemberBinding="{Binding Category}"
                                       Header="Category Name"
                                       IsGroupable="True"
                                       CellStyle="{StaticResource EditableCellStyle}"
                                       IsReadOnly="False">
                    <tk:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                            <tk:RadAutoCompleteBox ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.CategoryList}"
                                                  />
                        </DataTemplate>
                    </tk:GridViewDataColumn.CellEditTemplate>
                </tk:GridViewDataColumn>
in return the out put window looks like the attachment
 

5 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 11 Dec 2012, 12:21 PM
Hello Nivid,

In order to create a CellEditTemplate with RadAutoCompleteBox you will need to bind the DataMemberBinding of the GridViewDataColumn to the SelectedItem of the AutoCompleteBox control.

I created and attached a sample project for you showing the described approach.

Hope this is helpful.

Kind regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Nivid
Top achievements
Rank 2
answered on 11 Dec 2012, 02:43 PM
Thanks Vladi for the sample project i ran that still if you see the output 
there are binding errors

System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
The thread '<No Name>' (0xe08) has exited with code 0 (0x0).
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='RadWatermarkTextBox'
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=WatermarkTextBox'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'AutoCompleteBoxesWrapPanel' (Name=''); target property is 'Width' (type 'Double')
The thread 'vshost.RunParkingWindow' (0x1ff8) has exited with code 0 (0x0).
The thread '<No Name>' (0x1d3c) has exited with code 0 (0x0).
The program '[3168] AutoCompleteBoxInGridViewExample.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
0
Vladi
Telerik team
answered on 11 Dec 2012, 03:11 PM
Hi Nivid,

This are errors that come from the way some controls are loaded in the Framework. Some bindings get broken in the beginning but fast after that they are resolved and no exception is being thrown, you shouldn't worry about this errors.

Kind regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Nivid
Top achievements
Rank 2
answered on 22 Mar 2013, 03:03 PM
the two way binding on selected item nulls out the value. 
0
Vladi
Telerik team
answered on 25 Mar 2013, 12:23 PM
Hello Nivid,

We are not sure what you mean by "nulls out the value".

Could you give us more information on the issue at hand?

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
AutoCompleteBox
Asked by
Nivid
Top achievements
Rank 2
Answers by
Vladi
Telerik team
Nivid
Top achievements
Rank 2
Share this question
or