I just downloaded the controls and I'm following the documentation, in the section "Implementing the Navigation Framework" the example is pretty simple but I'm getting an error:
public Page2()
{
InitializeComponent();
}
public Page1()
{
InitializeComponent();
}
Both yield the error "The name 'InitializeComponent' does not exist in the current context"
What is the deal?
BTW, this line has a typo in the documentation:
Service.Target = Application.Current.RootVisual as Panel;
"Service" should be "service"
public Page2()
{
InitializeComponent();
}
public Page1()
{
InitializeComponent();
}
Both yield the error "The name 'InitializeComponent' does not exist in the current context"
What is the deal?
BTW, this line has a typo in the documentation:
Service.Target = Application.Current.RootVisual as Panel;
"Service" should be "service"
3 Answers, 1 is accepted
0
Hello Jeff,
To use RadNavigationFramework you have to do the following:
1.Add reference to Telerik.Windows.Controls.dll
2.In your UserControl class with telerik:RadPage include
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
The final page should look like:
3.After that go to code behind and make the class to Derive from RadPage.
public partial class Page1 : RadPage
{
public Page1()
{
InitializeComponent();
}
}
4.After you have done all this then the page should compile as expected.
Greetings,
Boryana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
To use RadNavigationFramework you have to do the following:
1.Add reference to Telerik.Windows.Controls.dll
2.In your UserControl class with telerik:RadPage include
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
The final page should look like:
<telerik:RadPage x:Class="PageNavigation.Page1"
Title="Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
< StackPanel x:Name="LayoutRoot" Background="Azure">
</StackPanel>
</telerik:RadPage>
Title="Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
< StackPanel x:Name="LayoutRoot" Background="Azure">
</StackPanel>
</telerik:RadPage>
3.After that go to code behind and make the class to Derive from RadPage.
public partial class Page1 : RadPage
{
public Page1()
{
InitializeComponent();
}
}
4.After you have done all this then the page should compile as expected.
Greetings,
Boryana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jeff
Top achievements
Rank 1
answered on 30 Jan 2009, 06:25 PM
Boryana,
Sorry for not being more clear - I did those things - I followed the documentation - in fact I copied the code. Here is my code:
Page1xaml
<telerik:RadPage x:Class="PageNavTestBench.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="LightGreen" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">
<TextBlock Text="Page 1" FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</telerik:RadPage>
Page1.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
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 Telerik.Windows.Controls;
namespace TelerikTest2
{
public partial class Page1 : RadPage
{
public Page1()
{
InitializeComponent();
}
private void LayoutRoot_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
{
NavigationService service = NavigationService.GetNavigationService();
service.Target = Application.Current.RootVisual as Panel;
service.Navigate( new Page2() );
}
}
}
Page2.xaml
<telerik:RadPage x:Class="PageNavTestBench.Page2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="LightBlue" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">
<TextBlock Text="Page 2" FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
Page2.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
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 Telerik.Windows.Controls;
namespace TelerikTest2
{
public partial class Page2 : RadPage
{
public Page2()
{
InitializeComponent();
}
private void LayoutRoot_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
{
NavigationService service = NavigationService.GetNavigationService();
service.Target = Application.Current.RootVisual as Panel;
service.Navigate( new Page1() );
}
}
}
</telerik:RadPage>
My project also has the references:
Telerik.Windows.Controls
Telerik.Windows.Controls.Navigation
But I still get the error. Do you se anything wrong?
Sorry for not being more clear - I did those things - I followed the documentation - in fact I copied the code. Here is my code:
Page1xaml
<telerik:RadPage x:Class="PageNavTestBench.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="LightGreen" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">
<TextBlock Text="Page 1" FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</telerik:RadPage>
Page1.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
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 Telerik.Windows.Controls;
namespace TelerikTest2
{
public partial class Page1 : RadPage
{
public Page1()
{
InitializeComponent();
}
private void LayoutRoot_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
{
NavigationService service = NavigationService.GetNavigationService();
service.Target = Application.Current.RootVisual as Panel;
service.Navigate( new Page2() );
}
}
}
Page2.xaml
<telerik:RadPage x:Class="PageNavTestBench.Page2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="LightBlue" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">
<TextBlock Text="Page 2" FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
Page2.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
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 Telerik.Windows.Controls;
namespace TelerikTest2
{
public partial class Page2 : RadPage
{
public Page2()
{
InitializeComponent();
}
private void LayoutRoot_MouseLeftButtonDown( object sender, MouseButtonEventArgs e )
{
NavigationService service = NavigationService.GetNavigationService();
service.Target = Application.Current.RootVisual as Panel;
service.Navigate( new Page1() );
}
}
}
</telerik:RadPage>
My project also has the references:
Telerik.Windows.Controls
Telerik.Windows.Controls.Navigation
But I still get the error. Do you se anything wrong?
0
Hi Jeff,
In the sample code you sent I saw the following error:
In your XAML class:
x:Class="PageNavTestBench.Page1"
This means that the namespace is : PageNavTestBench and the class is Page1.
However, in the code-behind you have :
namespace TelerikTest2 { public partial class Page1 : RadPage ... }
The namespace is different : TelerikTest2 !
In order to compile the code and Initialize the page there should be no difference between the namespace in the XAML and the code-behind. You should correct this and the code will compile.
Greetings,
Boryana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
In the sample code you sent I saw the following error:
In your XAML class:
x:Class="PageNavTestBench.Page1"
This means that the namespace is : PageNavTestBench and the class is Page1.
However, in the code-behind you have :
namespace TelerikTest2 { public partial class Page1 : RadPage ... }
The namespace is different : TelerikTest2 !
In order to compile the code and Initialize the page there should be no difference between the namespace in the XAML and the code-behind. You should correct this and the code will compile.
Greetings,
Boryana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.