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 6964785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:58:05+00:00 2026-05-27T15:58:05+00:00

I have a WPF DataGrid templatecolumn that has a DataTemplate for an AutoCompleteBox from

  • 0

I have a WPF DataGrid templatecolumn that has a DataTemplate for an AutoCompleteBox from the wpf toolkit. During RowEditEnding event and validation procedures, I am not able to see the content in the templatecolumn.

<DataGridTemplateColumn Header="Account Type" >
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <toolkit:AutoCompleteBox Text="{Binding Path='Account Type'}" Populating="PopulateAccountTypesACB" IsTextCompletionEnabled="True" BorderThickness="0" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>



public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
    {
        if ((value as BindingGroup).Items.Count == 0)
            return new ValidationResult(true, null);

        DataRowView row = (value as BindingGroup).Items[0] as DataRowView;

        if (row != null)
        {
            if (ValidateAccountName(row.Row.ItemArray[0].ToString()))
            {
                return new ValidationResult(true, null);
            }
            else
            {
                return new ValidationResult(false,
                    "Account Name must be between 1 and 100 Characters.");
            }
        }
        else
            return new ValidationResult(true, null);
    }

When I put a break point in my validation function after I create the DataRowView, the template column is empty. How would I get its content?

  • 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-27T15:58:05+00:00Added an answer on May 27, 2026 at 3:58 pm

    After looking into this, it seems like it doesn’t have anything to do with the DataGridTemplateColumn, but rather with the AutoCompleteBox from the Wpf Toolkit. The AutoCompleteBox has been nothing but trouble for me ever since I started using it. As a result, I decided to scrap it and use an Editable ComboBox instead. The combobox is much cleaner and more simple to implement. Here is how my code now looks and the datarowview is able to see what the user types in the box:

    <DataGridTemplateColumn Header="Account Type">
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Path='Account Type'}" />
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
        <DataGridTemplateColumn.CellEditingTemplate>
            <DataTemplate>
                <ComboBox IsEditable="True" LostFocus="LostFocusAccountTypes" ItemsSource="{DynamicResource types}" Height="23" IsTextSearchEnabled="True"/>
            </DataTemplate>
        </DataGridTemplateColumn.CellEditingTemplate>
    </DataGridTemplateColumn>
    

    Code Behind (this.Types is an observable collection of strings)

        private void PopulateAccountTypes()
        {
            try
            {
                string accountQuery = "SELECT AccountType FROM AccountType WHERE UserID = " + MyAccountant.DbProperties.currentUserID + "";
    
                SqlDataReader accountType = null;
                SqlCommand query = new SqlCommand(accountQuery, MyAccountant.DbProperties.dbConnection);
    
                accountType = query.ExecuteReader();
    
                while (accountType.Read())
                {
                    this.Types.Add(accountType["AccountType"].ToString());
                }
    
                accountType.Close();
                Resources["types"] = this.Types;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem with a WPF DataGrid from WPF Toolkit. The scrollbars
I have a wpf datagrid that has it's columns generated dynamically in code and
I'm using the datagrid from the WPF Toolkit for 3.5. I have a need
I have a wpf datagrid (.NET 4.0) that contains raw data from a database,
I have a dataset which i bind to datagrid from wpf toolkit(forced to use
I have a WPF toolkit DataGrid as the dropdown in a ComboBox template. <toolkit:DataGrid
I have a problem with my WPF application. I have a datagrid (Wpf Toolkit),
I have a WPF Toolkit DataGrid with one DataGridTemplateColumn. I've specified in a grid
I have a WPF form that contains a DataGrid. This DataGrid is editable. One
I have the next code where I defined a WPF toolkit datagrid control called

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.