SimpleGrid and SrollViewer

Sep 4, 2011 at 3:04 PM

I just spent few hours of searching why simpleGrid is readonly.

I don't know why, but when SimpleGrid is inside any ScrollViewer it is

unable to edit any value. You can try it for example in "FeaturesDemo" in "ColumnDefinition" tab.

I added scrollviewer like this:

<TabItem Header="ColumnDefinitions">
                        <ScrollViewer>
                            <pt:SimpleGrid Content="{Binding Items}">
                            <pt:SimpleGrid.ColumnDefinitions>
                                <pt:ColumnDefinition DataField="Country" Header="country" HorizontalAlignment="Left" />
                                <pt:ColumnDefinition DataField="Name" Header="name" HorizontalAlignment="Left" />
                                <pt:ColumnDefinition DataField="Population" Header="population" HorizontalAlignment="Right" />
                                <pt:ColumnDefinition DataField="IsCapital" Header="capital" HorizontalAlignment="Center" />
                            </pt:SimpleGrid.ColumnDefinitions>
                        </pt:SimpleGrid>
                        </ScrollViewer>
                    </TabItem>
Any idea how it is possible?

Coordinator
Sep 5, 2011 at 5:54 AM

The ScrollViewer seems to 'steal' the keyboard events.

You can set Focusable = false on the ScrollViewer, does that help?

Sep 5, 2011 at 7:51 AM
Edited Sep 5, 2011 at 7:53 AM

Yes it's work. Perfeect. Thank you.

First of all i thought that it's a magic :D :D

Everything worked and suddenly came magic. :D