Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF .Net 4.0 MVVM Binding DataGrid Cells To Array Element object
    primarykey
    data
    text
    <p>I am Creating a Timesheet application where there is a list of employees together with a list of Codings to assign time to.</p> <p>I have Created a DataMatrix And I have Got the grid looking Just fine EXCEPT the data entry of the hours</p> <p>The grid looks something like</p> <pre><code>Work Coding | AL | Sick | Job1 | Job2 ____________________________________________ Employee1 | | | | Employee2 | | | | public class DataMatrix : IEnumerable { public List&lt;MatrixColumn&gt; Columns { get; set; } // public List&lt;object[]&gt; Rows { get; set; } public List&lt;TimesheetDetail[]&gt; Rows { get; set; } IEnumerator IEnumerable.GetEnumerator() { return new GenericEnumerator(Rows.ToArray()); } } </code></pre> <p>The datagrid ItemsSource is TimesheetArray.</p> <p>The Issue I am having is when I enter data for Employee1 Job1 the datagrid looks like</p> <pre><code>Work Coding | AL | Sick | Job1 | Job2 ____________________________________________ Employee1 | 2 | 2 | 2 | 2 </code></pre> <p>Where I Want it looking like</p> <pre><code>Work Coding | AL | Sick | Job1 | Job2 ____________________________________________ Employee1 | | | 2 | </code></pre> <p>The Data Template looks like </p> <pre><code> &lt;DataTemplate x:Key="TimesheetEntryDetailCellTemplate" DataType="{x:Type data:TimesheetDetail}"&gt; &lt;Grid&gt;... &lt;Label Content="ST" /&gt; &lt;TextBox x:Name="txtStandardTime" Text="{Binding Path=HoursWorked, ...}"&gt;&lt;/TextBox&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre> <p>With debugging I am getting a TimesheetDetail[] object to bind to </p> <p>I think I need something like </p> <pre><code> &lt;TextBox Text="{Binding Source = TimesheetDetail[ColumnDisplayIndex].HoursWorked}" /&gt; </code></pre> <p>Does anyone know how I can get the cell template to bind to the element it is hooked to???</p> <p>Thanks in Advance</p>
    singulars
    1. This table or related slice is empty.
    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