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

FirstPagePosition Right problem when setting ItemsSource

10 Answers 122 Views
Book
This is a migrated thread and some comments may be shown as answers.
Levente Mihály
Top achievements
Rank 1
Levente Mihály asked on 04 May 2010, 12:19 PM
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


10 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 04 May 2010, 01:36 PM
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.
0
Levente Mihály
Top achievements
Rank 1
answered on 04 May 2010, 02:06 PM
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
0
Kiril Stanoev
Telerik team
answered on 04 May 2010, 02:14 PM
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.
0
Levente Mihály
Top achievements
Rank 1
answered on 04 May 2010, 02:19 PM
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
0
Accepted
Kiril Stanoev
Telerik team
answered on 04 May 2010, 02:49 PM
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.
0
Levente Mihály
Top achievements
Rank 1
answered on 04 May 2010, 03:01 PM
I went with the second approach, it worked fine.

thanks for your help
Levente
0
Alexandre
Top achievements
Rank 1
answered on 04 May 2010, 05:29 PM
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.

 

0
Levente Mihály
Top achievements
Rank 1
answered on 04 May 2010, 09:41 PM
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.
0
Alexandre
Top achievements
Rank 1
answered on 04 May 2010, 11:43 PM
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.
0
Kiril Stanoev
Telerik team
answered on 10 May 2010, 10:34 AM
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.
Tags
Book
Asked by
Levente Mihály
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Levente Mihály
Top achievements
Rank 1
Alexandre
Top achievements
Rank 1
Share this question
or