FirstPagePosition Right problem when setting ItemsSource

11 posts, 1 answers
  1. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 04 May 2010 Link to this post

    Hi,

    I set up a RadBook with RighPagePosition = Right, and I'm binding its ItemsSource to my ViewModel. The problem is, when the collection is set, the book "opens", however, with RighPageIndex = 0, it should stay closed.
    You can reproduce the issue with the following code too:
    private void Button_Click(object sender, RoutedEventArgs e) 
            { 
                ObservableCollection<string> List = new ObservableCollection<string>(); 
                List.Add("one"); 
                List.Add("two"); 
                List.Add("three"); 
                List.Add("four"); 
                radBook.ItemsSource = List; 
                //radBook.RightPageIndex = 0; 
            } 
    Are there any solutions?
    thanks,
    Levente


  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 04 May 2010 Link to this post

    Hi Levente,

    Unfortunately I was not able to reproduce the issue. I am attaching my sample project. Could you please have a look at it and let me know if I am doing anything wrong. I'd be glad to further assist you.

    Greetings,
    Kiril Stanoev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 04 May 2010 Link to this post

    Thanks for the quick reply. I couldn't reproduce the problem in your project. I created another sample, and the issue appeared again, but I can't see any real differences.. Can you please check it out?
    http://cid-d1452a0f3483ee55.skydrive.live.com/self.aspx/Nyilv%c3%a1nos/BookTest.zip


    Thanks,
    Levente
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 04 May 2010 Link to this post

    Hello Levente,

    In XAML, simply remove RightPageIndex="0". This should be enough to make it work properly. Let me know how it works for you.

    Regards,
    Kiril Stanoev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  6. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 04 May 2010 Link to this post

    Aaah, thanks, I missed that one.
    In my real project though I'm binding this property (Mode=TwoWay), so it has to be in the xaml too. Or are there any workarounds here? What is causing the problem?

    Levente
  7. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 04 May 2010 Link to this post

    Hi Levente,

    In this situation, you can choose between these two approaches.

    #1
    Missing RightPageIndex in RadBook and making the other control listen for the RightPageIndex

    Example:

    <telerikNavigation:RadBook x:Name="radBook" Height="572" VerticalAlignment="Top" Width="900"
                    FoldHintPosition="Bottom" ShowPageFold="OnPageEnter" IsTextSearchEnabled="False"
                    FirstPagePosition="Right" Margin="0,31,0,0"
                    RightPageTemplate="{StaticResource PageTemplate}"
                    LeftPageTemplate="{StaticResource PageTemplate}" />

    <telerik:RadSlider Maximum="5"
                    Value="{Binding RightPageIndex, ElementName=radBook, Mode=TwoWay}"
                    VerticalAlignment="Bottom" Width="200" IsSnapToTickEnabled="True" TickFrequency="1" />

    #2 Binding RightPageIndex in XAML, but set FirstPagePosition in code-behind

    Example:
    <telerikNavigation:RadBook x:Name="radBook" Height="572" VerticalAlignment="Top" Width="900"
                    FoldHintPosition="Bottom" ShowPageFold="OnPageEnter" IsTextSearchEnabled="False"
                    Margin="0,31,0,0"
                    RightPageTemplate="{StaticResource PageTemplate}"
                    RightPageIndex="{Binding Value, ElementName=slider1, Mode=TwoWay}"
                    LeftPageTemplate="{StaticResource PageTemplate}" />

    <telerik:RadSlider x:Name="slider1" Maximum="5" VerticalAlignment="Bottom" Width="200"
                    IsSnapToTickEnabled="True" TickFrequency="1" />

    private void Button_Click(object sender, RoutedEventArgs e)
    {
                this.radBook.FirstPagePosition = Telerik.Windows.Controls.PagePosition.Right;
                ObservableCollection<string> List = new ObservableCollection<string>();
                List.Add("one");
                List.Add("two");
                List.Add("three");
                List.Add("four");
                List.Add("five");
                radBook.ItemsSource = List;
                radBook.RightPageIndex = 0;
    }

    Give it a try and let me know if one of the approaches will work for you.

    Best wishes,
    Kiril Stanoev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  8. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 04 May 2010 Link to this post

    I went with the second approach, it worked fine.

    thanks for your help
    Levente
  9. Alexandre
    Alexandre avatar
    12 posts
    Member since:
    May 2009

    Posted 04 May 2010 Link to this post

    Hi I'm having the same prb, and I can't fix it.
    this is my radbook definition.

     

     

     

    <telerikNavigation:RadBook x:Name="RadBook1" Grid.Row="1" RightPageIndex="{Binding RightPageIndex, Mode=TwoWay}" Margin="20" FirstPagePosition="Right" IsKeyboardNavigationEnabled="True"

     

     

     

    ItemsSource="{Binding Presenters}" pf:Message.Attach="[Event PreviewPageFlipStarted] = [Action PageFlip($eventargs)]">

     

    .
    .
    .
    </telerikNavigation:RadBook>

    then on the code behind I have

     

     

     

       public partial class ShellView : UserControl  
        {  
            public ShellView()  
            {  
                InitializeComponent();  
                this.LayoutUpdated += new EventHandler(ShellView_LayoutUpdated);  
            }  
     
            void ShellView_LayoutUpdated(object sender, EventArgs e)  
            {  
                this.RadBook1.FirstPagePosition = Telerik.Windows.Controls.PagePosition.Right;  
            }  
        }  
     

    But this doesn't work,
    I don't want to use a radslider.
    Also this was working great on the previuos release after I install the q10 sp1 I start having this prb.

     

  10. Levente Mihály
    Levente Mihály avatar
    18 posts
    Member since:
    Jul 2008

    Posted 04 May 2010 Link to this post

    Hi,
    I removed the FirstPagePosition=Right from the xaml, and when the ItemsSource is bound (I'm sending a message from the ViewModel to the View), I set the FirstPagePosition from the code behind.
  11. Alexandre
    Alexandre avatar
    12 posts
    Member since:
    May 2009

    Posted 04 May 2010 Link to this post

    yes but that is not working cause when I change the FirstPagePosition to right the book must be doing something to my 1st view and that generates an exception.
    this was working great before the Q2010 SP1, will this be fix anytime soon?
    Thxs.
  12. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 10 May 2010 Link to this post

    Hello Alexandre,

    Unfortunately I was not able to reproduce the issue. What kind of exception does RadBook generate? I am attaching my sample project that tries to mimic your scenario. Could you please have a look at it and let me know if I am missing something. I'd be glad to further assist you.

    Regards,
    Kiril Stanoev
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft banner