GridView Paging bug when using custom row control template element loaded

5 posts, 0 answers
  1. Tomas Cyzas
    Tomas Cyzas avatar
    3 posts
    Member since:
    May 2010

    Posted 11 Nov 2015 Link to this post

    GridView Paging bug when using custom row control template element loaded.

    When the first element is loaded and its set to IsEnabled = false then the first element on the next page is also set to IsEnabled to false.

    bet when i go to the page number 3 and go back then is everything ok. 

    XAML:

     <CheckBox Name="assembledCheckBox"
      Margin="0,0,0,0"
      FontWeight="Bold"
      FontSize="10"
      Grid.Row="1"
      Grid.Column="1"
      VerticalAlignment="Center"
      HorizontalAlignment="Left" Content="Assembled"
      IsChecked="{Binding a_status}" Loaded="assembledCheckBox_Loaded"
     >​

     

     private void assembledCheckBox_Loaded(object sender, RoutedEventArgs e)
            {

                CheckBox temp = new CheckBox();
                temp = (CheckBox)sender;
                if (temp.IsChecked == true)
                {
                    temp.IsEnabled = false;
                }
            }​

     

  2. Tomas Cyzas
    Tomas Cyzas avatar
    3 posts
    Member since:
    May 2010

    Posted 12 Nov 2015 in reply to Tomas Cyzas Link to this post

    Maybe there is a workaround, to solve this problem or i'm doing something wrong?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Yoan
    Admin
    Yoan avatar
    1068 posts

    Posted 16 Nov 2015 Link to this post

    Hello Tomas,

    Generally, it is not recommended to work with visual elements directly when they are placed in GridView's row or cell. This is because of GridView's UI Virtualization mechanism which ensures recycling of the grid's rows and cells. This means that the Loaded event of your checkbox will be raised when RadGirdView reloads its rows. The recommended approach would be to work with the data items. In order to help you further, you can share more information about your scenario.

    Regards,
    Yoan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Tomas Cyzas
    Tomas Cyzas avatar
    3 posts
    Member since:
    May 2010

    Posted 16 Nov 2015 in reply to Yoan Link to this post

    Hello Yoan,

    The scenario is simple the custom row has 3 checkbox's.

    The checked value is selected from database values true or false. If the value is true the checkbox should be checked and isEnabled set to false.  If value is false  for the first checkbox should be not checked and enabled, but all the subs should be disabled. 

    And if the first is checked then the secod should be enabled and so on...

     Tomas

     

  6. Yoan
    Admin
    Yoan avatar
    1068 posts

    Posted 19 Nov 2015 Link to this post

    Hello Tomas,

    This should be easy to achieve using only your business object. I have created a sample project which demonstrates a possible approach. Please give it a try and let me know how it works for you.

    Regards,
    Yoan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready