Hi. We are using a XamGrid with a TemplateColumnLayout. Upon clicking the expander, we would like to populate the datatemplate with a user control from the code behind so we can swap out user controls dynamically.
I am currently subscribing to the "OnRowExpansionChanging" event, but can't seem to populate the cells with any content:
private void ResultsXamGrid_OnRowExpansionChanging(object sender, CancellableRowExpansionChangedEventArgs e) { e.Row.Cells[6].Content = new AddEditPlanting(); }
I would also like to get at the "Key" for the TemplateColumnLayout so I can pass that into the constructor of my usercontrol.
Thanks for your help.
<ig:XamGrid Name="ResultsXamGrid" Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ActiveItem="{Binding Path=SelectedCurrentField,Mode=TwoWay}" AutoGenerateColumns="False" ItemsSource="{Binding Path=AvailableCurrentFields}"> <ig:XamGrid.ColumnChooserSettings> <ig:ColumnChooserSettings AllowColumnMoving="True" AllowHiddenColumnIndicator="False" AllowHideColumnIcon="False" /> </ig:XamGrid.ColumnChooserSettings> <ig:XamGrid.EditingSettings> <ig:EditingSettings AllowEditing="Cell" IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True" /> </ig:XamGrid.EditingSettings> <ig:XamGrid.Columns> <ig:TextColumn Key="CurrentFieldNumber" HeaderText="Field" IsReadOnly="True" />
<ig:TextColumn Key="GrowerName" HeaderText="Grower" IsReadOnly="True" />
<ig:TemplateColumnLayout Key="CurrentFieldId"> <ig:TemplateColumnLayout.Template> <DataTemplate> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"> <Grid> </Grid> </ScrollViewer> </DataTemplate> </ig:TemplateColumnLayout.Template> </ig:TemplateColumnLayout>
</ig:XamGrid.Columns> </ig:XamGrid>
HI,
I am attaching a sample that dynamically loads the usercontrols of a TemplateColumnLayout.
In the code behind of the "MainWindow" file, you have commented out all of the code. Is that by design? I do not see in your code how I can programatically add a user control (or really any control) to the Template Column Layout.
Should I be trying to fill the content of a childband?