Xaml inside other XAML


i using wpf , silverlight bookcontrols mitsu

http://www.codeplex.com/wpfbookcontrol

the wpf example alows every page in book xaml file, silverlight example dont.

is there way load xaml in every book page in silverlight example ?

 

i have page.xaml

  <usercontrol x:class="slbookdemoapp.page"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:slmitsucontrols;assembly=slmitsucontrols"
width="800" height="600" loaded="usercontrol_loaded">
<grid>
<local:ucbook x:name="book" margin="50" />
</grid>
</usercontrol>


, correspondent page.xaml.cs

  
  using system;
using system.collections.generic;
using system.linq;
using system.windows;
using system.windows.controls;
using system.windows.documents;
using system.windows.input;
using system.windows.media;
using system.windows.media.animation;
using system.windows.shapes;
using slmitsucontrols;

namespace slbookdemoapp
{
public partial class page : usercontrol, idataprovider
{
public page()
{
initializecomponent();
}

private list<grid> pages;

private void usercontrol_loaded(object sender, routedeventargs e)
{
/*
pages = new list<button>
{
new button { content = "page 0"},
new button { content = "page 1", background = new solidcolorbrush(colors.green) },
new button { content = "page 2", background = new solidcolorbrush(colors.yellow) },
new button { content = "page 3", background = new solidcolorbrush(colors.brown) },
new button { content = "page 4", background = new solidcolorbrush(colors.magenta) },
new button { content = "page 5", background = new solidcolorbrush(colors.red) }
};
*/

system.windows.application.loadcomponent(this, new system.uri("/slbookdemoapp;pagteste2.xaml", system.urikind.relative));
grid layoutroot = ((grid)(findname("layoutroot")));
//textblock testtextblock = ((textblock)(findname("testtextblock")));

pages = new list<grid>
{
};

pages.add(layoutroot);
/*
int = 0;
foreach (var b in pages)
{
if (i % 2 == 0)
b.click += button_click;
else
b.click += button_click_1;
i++;
}
*/

book.setdata(this);
}

#region idataprovider members

public object getitem(int index)
{
return pages[index];
}

public int getcount()
{
return pages.count;
}

#endregion

private void button_click(object sender, routedeventargs e)
{
book.animatetonextpage(500);
}

private void button_click_1(object sender, routedeventargs e)
{
book.animatetopreviouspage(500);
}
}
}


, xaml wnat include pagteste2.xaml

 
   <grid
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:class="slbookdemoapp.pagteste2"
x:name="layoutroot">
<rectangle width="192" height="80" fill="#ff8f0a0a" stroke="#ff000000" canvas.left="224" canvas.top="104"/>

</grid>


correspondent pagteste2.xaml.cs

 
   using system;
using system.io;
using system.net;
using system.windows;
using system.windows.controls;
using system.windows.data;
using system.windows.media;
using system.windows.media.animation;
//using system.windows.navigation;
using slmitsucontrols;

namespace slbookdemoapp
{
public partial class pagteste2
{
public pagteste2()
{
this.initializecomponent();

// insert code required on object creation below point.
}
}
}


getting error on line

    system.windows.application.loadcomponent(this, new system.uri("/slbookdemoapp;pagteste2.xaml", system.urikind.relative));

anyone knows why ?



Archived Forums SA-SM  >  Silverlight (formerly WPF/E) Developer Issues



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........