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

[Solved] Collapsed grid on DataTemplate recieves focus

2 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
joao rodrigues
Top achievements
Rank 1
joao rodrigues asked on 30 Nov 2010, 04:19 PM
Hi,

I have a GridView with a CellEditTemplate like this:
<telerik:RadGridView Grid.Column="1" ItemsSource="{Binding Path=Items}" AutoGenerateColumns="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="COL_BEFORE" DataMemberBinding="{Binding Path=name}"  />
        <telerik:GridViewDataColumn Header="COLLAPSED" Width="90">
            <telerik:GridViewDataColumn.CellEditTemplate>
                <DataTemplate>
                    <Grid Visibility="Collapsed" GotFocus="grid_inside_radgrid_GotFocus">
                        <TextBox Visibility="Collapsed" Text="ole" GotFocus="textbox_inside_grid_inside_radgrid_GotFocus"  />
                    </Grid>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn Header="COL_AFTER" DataMemberBinding="{Binding Path=name}" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

As you can see, the Grid inside the data template is Collapsed. Yet, in edit mode, the textbox inside the grid receives focus and the grid itself receives the focus since the both GotFocus  events are fired.

If I do the same thing inside a stackpanel for example,
<StackPanel>
    <TextBox Text="TXT_Before" />
    <Grid Visibility="Collapsed"  GotFocus="Grid_GotFocus">
        <TextBox Text="ole" GotFocus="TextBox_GotFocus" />
    </Grid>
    <TextBox Text="TXT_AFTER"  />
</StackPanel>

as expected, the Focus events are never fired.

If I turn the inside Textbox also collapsed the behavior became correct but, for me this is not a valid workaround.


A final note : If I do the same thing in CellTemplate (the above one is in CellEditTemplate) the focus leaves the grid when hitting the column.

Can you help me here ?

Thanks,
Joao

2 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 02 Dec 2010, 02:05 PM
Hi joao rodrigues,

I've managed to reproduce the issue. Thank you for reporting this out.
Actually you've sent a working CellEditTemplate which sets TextBox.Visibility to Collapsed. Indeed this is a workaround and the real solution will come with the next latest internal build (every Monday night). Sorry for the inconvenience caused.

P.S. I've updated your Telerik points accordingly.

Greetings,
Nedyalko Nikolov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
joao rodrigues
Top achievements
Rank 1
answered on 02 Dec 2010, 03:12 PM
Hi Nedyalko Nikolov,

Indeed I've sent the  "workaround" version. I'm glad that, even so, you have noticed the problem :)

I'll wait for next internal built.

Thank You!

Tags
GridView
Asked by
joao rodrigues
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
joao rodrigues
Top achievements
Rank 1
Share this question
or