I
I
IartanisI2019-06-19 16:49:32
WPF
IartanisI, 2019-06-19 16:49:32

What is the Binding in this example?

There is such a function

static public List<string> GetData()
{
  List<string> data = new List<string>();
  string sql = "select distinct NameVicon1 from FullBases";
  SQLiteConnection conn = new SQLiteConnection(@"Data Source=U:\Install\AppZvit\Zhur-Test.db"); ;
  conn.Open();
  SQLiteCommand cmd = new SQLiteCommand(sql, conn);

  SQLiteDataReader reader = cmd.ExecuteReader();

  while (reader.Read())
  {
    var b1 = Regex.Split(Convert.ToString(reader["NameVicon1"]), ";");
    for (int i = 0; i < b1.Length; i++)
    {
      data.Add(Convert.ToString(b1[i]));
    }
  }
  conn.Close();
  return data;
}

And there is the WPFTextBoxAutoComplete library
<TextBox Width="250"
     HorizontalAlignment="Center"
     Text="{Binding TestText, UpdateSourceTrigger=PropertyChanged}" 
     behaviors:AutoCompleteBehavior.AutoCompleteItemsSource="{Binding TestItems}"/>

In it, you can initialize a TextBox with padding support. I don’t understand how to add my function to Binding at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IartanisI, 2019-06-20
@IartanisI

Solved this problem. Everything turned out to be easier. NameTextBox.ItemsSource = GetData();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question