Note that there are some explanatory texts on larger screens.

plurals
  1. POTextbox binding to list won't update
    primarykey
    data
    text
    <p>HI, I have a list of coursesTaken with dates (returned by a nested class). Since I am not sure howmany courses the person took, I just bind it to textboxes and is working fine. The datacontext of the grid is the list itself so I assume whenever I make changes to the form, it is automatically sent back to the list and add it, but when it is time to save it in DB, the list won't change. I tried making the list as an observable collection and bind mode two way but still won't change. when I try to put Onpropertychange it says "Cannot acces a non static member of outer type via nested type..." What I want to do is whenever I type / add something to textbox, the list will add it as it's nth item so I can iterate and save it in DB. </p> <p>is ther any other way to do this? please see code below. thanks! </p> <pre><code> #region class for binding purposes (nested class) public class ListCon { public ObservableCollection&lt;tblGALContinuingEducationHistory&gt; EducList { get { return new ObservableCollection&lt;tblGALContinuingEducationHistory&gt;(contEducHstoryList); } } } #endregion #region constructor public ContinuingEducHistoryPopUp(tblAttorneyGalFileMaint currentGal) { contEducHstoryList = new ObservableCollection&lt;tblGALContinuingEducationHistory&gt;(); InitializeComponent(); if (currentGal != null) { CurrentGal = currentGal; txtMemberName.Text = CurrentGal.FullName; contEducHstoryList = new ObservableCollection&lt;tblGALContinuingEducationHistory&gt;(currentGal.tblGALContinuingEducationHistories.Count &gt; 0 &amp;&amp; currentGal.tblGALContinuingEducationHistories != null ? currentGal.tblGALContinuingEducationHistories : null); } this.DataContext = new ListCon(); } #endregion </code></pre> <p>Now here's my xaml</p> <pre class="lang-xml prettyprint-override"><code>&lt;Grid Grid.Row="2" Grid.ColumnSpan="2" Name="grdEducForm"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="25" /&gt; &lt;RowDefinition Height="25" /&gt; &lt;RowDefinition Height="25" /&gt; &lt;RowDefinition Height="25" /&gt; &lt;RowDefinition Height="25" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="2*" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TextBox Text="{Binding Path=EducList[0].CourseTitle}" Grid.Column="0" Grid.Row="0" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[0].CertificateDate}" Grid.Column="1" Grid.Row="0" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[0].CertificateExpiration}" Grid.Column="2" Grid.Row="0" /&gt; &lt;TextBox Text="{Binding EducList[1].CourseTitle}" Grid.Column="0" Grid.Row="1" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[1].CertificateDate}" Grid.Column="1" Grid.Row="1" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[1].CertificateExpiration}" Grid.Column="2" Grid.Row="1" /&gt; &lt;TextBox Text="{Binding Path=EducList[2].CourseTitle}" Grid.Column="0" Grid.Row="2" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[2].CertificateDate}" Grid.Column="1" Grid.Row="2" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[2].CertificateExpiration}" x:Name="dpEnd3" Grid.Column="2" Grid.Row="2" /&gt; &lt;TextBox Text="{Binding Path=EducList[3].CourseTitle, Mode=TwoWay}" Grid.Column="0" Grid.Row="3" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[3].CertificateDate, Mode=TwoWay}" Grid.Column="1" Grid.Row="3" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[3].CertificateExpiration}" Grid.Column="2" Grid.Row="3" /&gt; &lt;TextBox Text="{Binding Path=EducList[4].CourseTitle}" Name="txtEducName5" Grid.Column="0" Grid.Row="4" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[4].CertificateDate}" x:Name="dpStart5" Grid.Column="1" Grid.Row="4" /&gt; &lt;useable:MaskedDatePicker DateValue="{Binding Path=EducList[4].CertificateExpiration}" x:Name="dpEnd5" Grid.Column="2" Grid.Row="4" /&gt; &lt;/Grid&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload