AutoCompleteBox inside RadGrid not working.

6 posts, 0 answers
  1. Nivid
    Nivid  avatar
    14 posts
    Member since:
    Jun 2012

    Posted 10 Dec 2012 Link to this post

    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
     
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 11 Dec 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Nivid
    Nivid  avatar
    14 posts
    Member since:
    Jun 2012

    Posted 11 Dec 2012 Link to this post

    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).
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 11 Dec 2012 Link to this post

    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.

  6. Nivid
    Nivid  avatar
    14 posts
    Member since:
    Jun 2012

    Posted 22 Mar 2013 Link to this post

    the two way binding on selected item nulls out the value. 
  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 25 Mar 2013 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready