Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6608539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:37:14+00:00 2026-05-25T19:37:14+00:00

I’m new to silverlight and I’m tasked with changing the datagrid TextColumns to autocomplete

  • 0

I’m new to silverlight and I’m tasked with changing the datagrid TextColumns to autocomplete boxes. I thought this should be fairly simple but apparently it isn’t.

I’m able to bind the data from a list outside the datagrid but not from within.

I’ve been researching for two days now and everything I find seems to incorporate data from a database or is otherwise too complex for my newbie brain to figure out.

All I really need is a simple example and explanation of how to do this in a datagrid as opposed to regularly.

My code follows. It builds succesfully but does not work properly.

I’m sure this is a problem that many others must have come across.

I appreciate anyone’s input,
Thanks in advance.
d.

    <UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
         xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="AccordionAutoCompleteBox.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="680" d:DesignWidth="1240">
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel VerticalAlignment="Center">
        <toolkit:AccordionItem x:Name="AccordionItem2" FontSize="12" Background="LightBlue" BorderBrush="Wheat" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsSelected="False" MaxHeight="400">
            <sdk:DataGrid Name="AccordionGrid"  ItemsSource="{Binding ExpData}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HeadersVisibility="All" BorderThickness="1" Margin="8" SelectionMode="Single" Canvas.ZIndex="-1" MaxHeight="360">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTemplateColumn Header="Exp">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <sdk:AutoCompleteBox x:Name="AutoCompGrid" Text="{Binding Exp, Mode=TwoWay}" ItemsSource="{Binding Exp}"  IsTextCompletionEnabled="True" />

                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTextColumn Header="Exp" Binding="{Binding Exp}" IsReadOnly="False" />
                    <sdk:DataGridTextColumn Header="Desc" Binding="{Binding Desc}" IsReadOnly="False" />
                    <sdk:DataGridTextColumn Header="Prod" Binding="{Binding Prod}" IsReadOnly="False" />
                    <sdk:DataGridTextColumn Header="Source" Binding="{Binding Source}" IsReadOnly="False" />
                    <sdk:DataGridTextColumn Header="Start" Binding="{Binding Start}" IsReadOnly="False" />
                    <sdk:DataGridTextColumn Header="Reset" Binding="{Binding Reset}" IsReadOnly="False" />
                    <sdk:DataGridTextColumn Header="Amt" Binding="{Binding Amt}" IsReadOnly="False" />

                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </toolkit:AccordionItem>
        <sdk:AutoCompleteBox x:Name="AutoCompGrid2" Text="{Binding Exp}" ItemsSource="{Binding Exp}" IsTextCompletionEnabled="False" />
    </StackPanel>
</Grid>

And the code behind

    namespace AccordionAutoCompleteBox

{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();

        List<ExpData> myList = new List<ExpData>
        {
            new ExpData
            {Exp = "cell 1",
            Desc = "cell 2",
            Prod = "cell 3",
            Source = "cell 4",
            Start = "cell 5",
            Amt = "cell 6",
            Reset = "cell 7"},

            new ExpData
            {Exp = "cell 8",
            Desc = "cell 9",
            Prod = "cell 10",
            Source = "cell 11",
            Start = "cell 12",
            Amt = "cell 13",
            Reset = "cell 14"}
        };
        AccordionGrid.ItemsSource = myList;
        AutoCompGrid2.ItemsSource = myList;

        this.AccordionItem2.Header = " Accordion Header ";

    }
}
public class ExpData
{
    public String Exp { get; set; }
    public String Desc { get; set; }
    public String Prod { get; set; }
    public String Source { get; set; }
    public String Start { get; set; }
    public String Reset { get; set; }
    public String Amt { get; set; }

    public ExpData(String exp, string desc, string prod, string source, string start, String reset, String amt)
    {
        Exp = exp;
        Desc = desc;
        Prod = prod;
        Source = source;
        Start = start;
        Reset = reset;
        Amt = amt;
    }

    public override string ToString()
    {
        return Exp;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:37:14+00:00Added an answer on May 25, 2026 at 7:37 pm

    Your life would be a lot easier if you had a view model. 🙂 Quick example of using a ViewModel to solve this.

    public class ExpDataViewModel
    {
      private List<ExpData> _listData;
    
      public ExpDataViewModel()
      {
        _listData = new List<ExpData>
            {
                new ExpData
                {Exp = "cell 1",
                Desc = "cell 2",
                Prod = "cell 3",
                Source = "cell 4",
                Start = "cell 5",
                Amt = "cell 6",
                Reset = "cell 7"},
    
                new ExpData
                {Exp = "cell 8",
                Desc = "cell 9",
                Prod = "cell 10",
                Source = "cell 11",
                Start = "cell 12",
                Amt = "cell 13",
                Reset = "cell 14"}
            };
      }
    
      public IEnumerable<ExpData> ListData
      {
        get {return _listData;}
      }     
    
      public IEnumerable<string> ExpItems
      {
        get {return _listData.Select(i => i.Exp);
      }
    }
    

    Then you would need to change your view:

    <UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="AccordionAutoCompleteBox.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="[Your ViewModel's Namespace]"
    mc:Ignorable="d"
    d:DesignHeight="680" d:DesignWidth="1240">
    <UserControl.Resources>
      <vm:ExpDataViewModel x:Key="vm" />
    </UserControl.Resource>
    
        <Grid x:Name="LayoutRoot" Background="White" DataContext="{StaticResource vm}">
            <StackPanel VerticalAlignment="Center">
            <toolkit:AccordionItem x:Name="AccordionItem2" FontSize="12" Background="LightBlue" BorderBrush="Wheat" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsSelected="False" MaxHeight="400">
                <sdk:DataGrid Name="AccordionGrid"  ItemsSource="{Binding ListData}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HeadersVisibility="All" BorderThickness="1" Margin="8" SelectionMode="Single" Canvas.ZIndex="-1" MaxHeight="360">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTemplateColumn Header="Exp">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <sdk:AutoCompleteBox x:Name="AutoCompGrid" Text="{Binding Exp, Mode=TwoWay}" ItemsSource="{Binding Path=ExpItems, Source={StaticResource vm}}"  IsTextCompletionEnabled="True" />
    
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTextColumn Header="Exp" Binding="{Binding Exp}" IsReadOnly="False" />
                        <sdk:DataGridTextColumn Header="Desc" Binding="{Binding Desc}" IsReadOnly="False" />
                        <sdk:DataGridTextColumn Header="Prod" Binding="{Binding Prod}" IsReadOnly="False" />
                        <sdk:DataGridTextColumn Header="Source" Binding="{Binding Source}" IsReadOnly="False" />
                        <sdk:DataGridTextColumn Header="Start" Binding="{Binding Start}" IsReadOnly="False" />
                        <sdk:DataGridTextColumn Header="Reset" Binding="{Binding Reset}" IsReadOnly="False" />
                        <sdk:DataGridTextColumn Header="Amt" Binding="{Binding Amt}" IsReadOnly="False" />
    
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
            </toolkit:AccordionItem>
            <!-- not sure what this is supposed to be bound to --> 
            <sdk:AutoCompleteBox x:Name="AutoCompGrid2" Text="{Binding Exp}" ItemsSource="{Binding Exp}" IsTextCompletionEnabled="False" />
        </StackPanel>
    </Grid>
    

    And you can remove all your custom code from the code behind file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.