This question is locked. New answers and comments are not allowed.
I have a book that loads 1 of 5 templates dynamically based on the PageItem, no problem there.
Each Template hosts a user control. I need to pass the page.datacontext to the usercontrol. I have a public property on the user control to accept the data but don't know how to get it there.
So one of my templates is:
I have a Page Selector that loads the appropriate template:
In my Code behind in sub new I have:
(I also load a bunch of other types, but you get the point)
So far so good, the book loads and the correct template is displayed on the page
So now how do I get the Page.DataContext to the user control. I was looking at PreviewPageFlipStarted since I have to do some validation there anyway. Is that where I would do this or is there a simpler way?
Am I going down the wrong path with Page.DataContext? Can I just some how pass the current Item from the ItemSource to the control?
Thanks
Mike
Each Template hosts a user control. I need to pass the page.datacontext to the usercontrol. I have a public property on the user control to accept the data but don't know how to get it there.
So one of my templates is:
<DataTemplate x:Key="DocTemplate"> <Grid> <pmbUC:ctrlDoc></pmbUC:ctrlDoc> </Grid> </DataTemplate><local:PageTemplateSelector x:Key="PageSelector" DocTemplate="{StaticResource DocTemplate}" . . . . > </local:PageTemplateSelector>In my Code behind in sub new I have:
For x = 1 To 500 _Pages.Add(New PageClass(PageClass.PageClassType.Doc, x)) Next RadBook1.ItemsSource = _Pages So far so good, the book loads and the correct template is displayed on the page
So now how do I get the Page.DataContext to the user control. I was looking at PreviewPageFlipStarted since I have to do some validation there anyway. Is that where I would do this or is there a simpler way?
Am I going down the wrong path with Page.DataContext? Can I just some how pass the current Item from the ItemSource to the control?
Thanks
Mike
