Telerik 2012.2.607.40
Scenario:
1. I have an object let's say VitalSign.
Vital Sign (Object)
- Name
- Value
2. A user may enter 1 to n Vital signs as a single set of entries. This action will create one row. For that row there will be n number of columns based on the number of vital signs the user entered during that discrete operation. If the user performs the action a second time then there will be 2 rows and the number of columns will be Max(Number Of Vital Signs For Discrete Operation).
Ex Display:
Temp Heart Rate Blood Pressure Pulse
98 55 120/80 120 - Discrete Entry 1 (4 Vital Signs)
65 125/90 124 - Discrete Entry 2 ( 3 Vital Signs)
62 - Discrete Entry 3 ( 1 Vital Sign)
3. So I dynamically generate a table to create the appropriate columns which contains all columns for any row which has a value. In the example above there is no Blood Sugar value for any discrete entry so this column would not be generated.
4. When I create my columns I create them as objects like this.
vitalSignsTable.Columns.Add(vitalSign, typeof (VitalSign));
4. Next I Bind a RadDataGrid to the dynamically generated DataTable and set the AutoGenerateColumns = true
5. Next I handle the AutoGeneratingColumn event and set the column Template to the template below.
My question is, how do I bind the Text property in the TextBox in my template to a value from the VitalSign object?. If I DO NOT use a template, and instead just create a ToString() for my VitalSign object, I can display the correct values in the Grid, but I need to use the VitalSign's object properties for other reasons.
NOTE: I know I can Bind to ItemArray[Index].Property to bind directly to the object, but to do this, I have to know the correct index before runtime, and since the columns are dynamically determined at runtime, I have no way to know this.
TEMPLATE
Thanks,
Billy Jacobs
Scenario:
1. I have an object let's say VitalSign.
Vital Sign (Object)
- Name
- Value
2. A user may enter 1 to n Vital signs as a single set of entries. This action will create one row. For that row there will be n number of columns based on the number of vital signs the user entered during that discrete operation. If the user performs the action a second time then there will be 2 rows and the number of columns will be Max(Number Of Vital Signs For Discrete Operation).
Ex Display:
Temp Heart Rate Blood Pressure Pulse
98 55 120/80 120 - Discrete Entry 1 (4 Vital Signs)
65 125/90 124 - Discrete Entry 2 ( 3 Vital Signs)
62 - Discrete Entry 3 ( 1 Vital Sign)
3. So I dynamically generate a table to create the appropriate columns which contains all columns for any row which has a value. In the example above there is no Blood Sugar value for any discrete entry so this column would not be generated.
4. When I create my columns I create them as objects like this.
vitalSignsTable.Columns.Add(vitalSign, typeof (VitalSign));
4. Next I Bind a RadDataGrid to the dynamically generated DataTable and set the AutoGenerateColumns = true
5. Next I handle the AutoGeneratingColumn event and set the column Template to the template below.
My question is, how do I bind the Text property in the TextBox in my template to a value from the VitalSign object?. If I DO NOT use a template, and instead just create a ToString() for my VitalSign object, I can display the correct values in the Grid, but I need to use the VitalSign's object properties for other reasons.
NOTE: I know I can Bind to ItemArray[Index].Property to bind directly to the object, but to do this, I have to know the correct index before runtime, and since the columns are dynamically determined at runtime, I have no way to know this.
TEMPLATE
<
DataTemplate
x:Key
=
"PatientVitalSignTemplate"
>
<
TextBox
Text
=
"{Binding ???????????}"
/>
</
DataTemplate
>
Thanks,
Billy Jacobs