Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Problem with XamGrid Vertical Scrollbar
posted

I have a vertical scroll bar on my XamGrid.

According to XamGrid's height it can show only six records.

It has one Template Column with RationButton.

The problem is when the data is more than six records lets say 10

at the time of loading if the radio button got selected on the first row as per the database value
and If I scoll down and select the radio button at the bottom and scroll up gain the radio button on the first row gets uncheched that is expected behaviour of Radion button. no issues at this point.

Then If I select the radion button on the first row and scroll down to the last row  the ratio button on the last row is also shows as checked.

Other thing is if I scroll up again back to the first row the first row is unchecked, I am not sure why it is unchecked

If I repeat this any number of times the first row is never getting selected.

Can some one help me on this?

I am using VS2010, Silverlight 4 and Infragistics's Netadvantage for Silverlithg Line of business V10.3

 

Here is the Xaml and code behind to bind the gird.

Xaml
----
<ig:XamGrid x:Name="xamGridEvents" ScrollViewer.VerticalScrollBarVisibility="Auto" AutoGenerateColumns="False" RowHeight="23"
                     CellClicked="xamGridEvents_CellClicked">

            <ig:XamGrid.SortingSettings>
                <ig:SortingSettings AllowSorting="False" ></ig:SortingSettings>
            </ig:XamGrid.SortingSettings>

            <ig:XamGrid.Columns>
                <ig:TextColumn HeaderText="Event" Key="EventType" IsReadOnly="True" HeaderTextHorizontalAlignment="Center" HorizontalContentAlignment="Center"  Width="80" />
                <ig:TemplateColumn HeaderText="Yes/No" Key="YesNoFlag" HorizontalContentAlignment="Center" Width="*"  >
                    <ig:TemplateColumn.ItemTemplate >
                        <DataTemplate >
                            <RadioButton HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="{Binding Path=YesNoFlag, Mode=TwoWay}"  GroupName="GroupradioButtonInEvent" Name="radioButtonInEvent"  />
                        </DataTemplate>
                    </ig:TemplateColumn.ItemTemplate>
                </ig:TemplateColumn>
            </ig:XamGrid.Columns>
        </ig:XamGrid>


Code behind
xamGridEvents.ItemsSource = e.Result.EventList;

Parents
No Data
Reply
  • 40030
    Offline posted

    Hi, 

    So basically a RadioButton's default functionality won't work in the xamGrid, b/c of virtualization. When a cell is out of view, there is no UI link to it anymore. Which means when you change another radio button, the currently checked cell will never get notified of a change if its not in view. 

    So, you need to implement this logic in your ViewModel, where you keep track of the last checked data object, and listen to see if the checked property of another data object gets checked. If that happens then you update the lastChecked data object to false. 

    Hope this helps, 

    -SteveZ

Children