This is a migrated thread and some comments may be shown as answers.

Multiple controls in CellEditTemplate

1 Answer 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 28 Jan 2013, 08:51 PM
Hello,

I currently have a ToggleButton and a Textblock inside a gridcell. The ToggleButton shows/hides a RowDetailsTemplate. How can I make the ToggleButton AND Textblock both visible within a CellEditTemplate.

<telerik:GridViewDataColumn DataMemberBinding="{Binding Account}"
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <Grid
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <ToggleButton IsChecked="{Binding DetailsVisible}" />
                <TextBlock  Grid.Column="1" Text="{Binding Description}"/>
            </Grid>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <TextBox Text="{Binding Description}" />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>


It seems to through an unhandled exception when I wrap both of these controls inside of a Grid within the CellEditTemplate. any ideas?

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 06 Feb 2013, 03:47 PM
Hello,

Here is a piece of working XAML:

<telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" >
                   <telerik:GridViewDataColumn.CellEditTemplate>
                       <DataTemplate>
                           <StackPanel>
                               <TextBox Text="{Binding ID}"/>
                               <Button Width="100" Height="20" Content="Button" />
                           </StackPanel>
                       </DataTemplate>
                   </telerik:GridViewDataColumn.CellEditTemplate>

Additionally  I am attaching a runnable project demonstrating this in action.

Kind regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or