visual studio 2012 - Navigating to wpf page based on timer -


i'm trying navigate different page mainwindow in wpf application. mainwindow has welcome text , want move page after 4 seconds. timer working fine getting error says,

"error 1 'ubitutorial.mainwindow' not contain definition 'frame' , no extension method 'frame' accepting first argument of type 'ubitutorial.mainwindow' found (are missing using directive or assembly reference?) c:\users\thomas\documents\visual studio 2012\projects\ubitutorial\ubitutorial\mainwindow.xaml.cs 54 22 ubitutorial"

in method

if (introtime > 4) {     this.frame.navigate(typeof(touch)); } 

visual studio complaining frame part of it.

frame control type not control instance, without seeing xaml have no idea of name of frame added is, defaulted frame1 need use access navigate method. give idea.

mainwindow.xaml

<window x:class="wpfapplication1.mainwindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         title="mainwindow" height="350" width="525">     <grid>         <frame height="100" horizontalalignment="left" margin="10,10,0,0" name="frame1" verticalalignment="top" width="200" />     </grid> </window> 

mainwindow.xaml.cs

using system.windows.threading;  namespace wpfapplication1 {      /// <summary>      /// interaction logic mainwindow.xaml      /// </summary>      public partial class mainwindow : window      {          dispatchertimer introtime = new dispatchertimer();          public mainwindow()          {              initializecomponent();              introtime.interval = timespan.fromseconds(4);              introtime.tick += new eventhandler(introtime_tick);              introtime.start();          }           void introtime_tick(object sender, eventargs e)          {              //this.frame1.navigate(new uri(@"http://www.google.com"));              this.frame1.navigate(new usercontrol1());          }      }  } 

usercontrol1.xaml

<usercontrol x:class="wpfapplication1.usercontrol1"              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"               mc:ignorable="d"               d:designheight="300" d:designwidth="300" background="red" >     <grid>      </grid> </usercontrol> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -