I develop my App UI with XAML and in Background I run a C# program.
To make it bit easier to explain: Lets say the program shall Display Paramters in a ListView/Grid.
- Column 1 is the Parameter Name (string)
- Column 2 is the Parameter Value (string or string [,])
The Parameter Value can be a single value (displayed as Label) or a vector/matrix (displayed as Grid inside this cell). I have no idea how I can also add a other grid here with unknown column number, the number will be different for each paramter.
All the Parameters are in a List and loaded with a ItemSource + DisplayMemberBinding dynamically.
So what I Need: - A Grid in a DataTemplate - A Grid with unknown number of rows
<DataTemplate x:Key="labelTemplate">
<Label Content="{Binding Path=Value}" Width="Auto"></Label>
</DataTemplate>
<DataTemplate x:Key="table2DTemplate">
</DataTemplate>
<local:ParameterTemplateSelector
x:Key="parameterTemplateSelector"
LabelTemplate="{StaticResource labelTemplate}"
Table2DTemplate ="{StaticResource table2DTemplate}"/>
MY Datatempaltes + TemplateSelector:
<ListView ItemsSource="{Binding Parameters}" Margin="10,156,10.286,10.429" x:Name="listBox1" FontSize="8" Background="White" Foreground="Black" BorderBrush="#FF60EFBB">
<ListView.View>
<GridView>
<GridViewColumn
Header="Name"
Width="Auto"
DisplayMemberBinding="{Binding Name}" />
<GridViewColumn
Header="Value"
Width="Auto"
CellTemplateSelector="{StaticResource parameterTemplateSelector}" />
<GridViewColumn
Header="Unit"
Width="Auto"
</GridView>
</ListView.View>
</ListView>
>`, or to convert it for display purposes?
– 15ee8f99-57ff-4f92-890c-b56153 Oct 30 '17 at 19:22