Advertisement

03.17.2008 at 08:42AM PDT, ID: 23247369
[x]
Attachment Details

WPF databinding

Asked by ozencozturk in C# Programming Language, .Net Editors & IDEs, .NET Framework 3.x versions

Tags: c#

I am trying to bind data to textbox controls (through code).   Databinding through XAML works but i haven't managed to achieve the same behavior through code.
Basically what i am trying to do is binding the XCeed datagrid's selecteditem property to some textbox's. (Sort of bindingsource behavior in .net 2.0)

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
// acquire data and bind it to XCEED datagrid (WORKING)
chequeService = new ChequeService();
BindingList<Cheque> chequeList = new BindingList<Cheque>(chequeService.GetEntityList());
DataGridCollectionView dataGridCollectionView = new DataGridCollectionView(chequeList);
dgvProducts.ItemsSource = dataGridCollectionView;
 
//XAML databinding to a textbox(WORKING) I need equivalent C# code for this XAML. 
<Grid DataContext="{Binding ElementName=dgvProducts, Path=SelectedItem}" HorizontalAlignment="Right" Margin="0,30,29,0" Name="grid1" Width="233" Height="95" VerticalAlignment="Top">
<TextBox Text="{Binding Path=ChequeID}" Height="22" Margin="0,12,36,0" Name="textBox1" VerticalAlignment="Top" HorizontalAlignment="Right" Width="91" />
</Grid>
[+][-]03.17.2008 at 09:37AM PDT, ID: 21143792

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.17.2008 at 10:18AM PDT, ID: 21144191

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.17.2008 at 11:11AM PDT, ID: 21144625

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 12:00AM PDT, ID: 21148847

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 01:53PM PDT, ID: 21155714

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C# Programming Language, .Net Editors & IDEs, .NET Framework 3.x versions
Tags: c#
Sign Up Now!
Solution Provided By: fs99erab
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628