I want to use RadPanelBar with CM (use MEF as DI container). Every RadPanelBarItem should has something that is determined by other modules.
For examples, the following is my code structure:
MyProject.NavigationPane
NavigationPaneView.xaml
NavigationPaneViewModule.cs
MyProject.NavigationItem.Example1
Example1View.xaml (maybe any content)
Example1ViewModel.cs
MyProject.NavigationItem.Example2
Example2View.xaml (maybe any content)
Example2ViewModel.cs
NavigationPaneView.xaml contains the RadPanelBar. I want to use the strength of CM to dynamically create two RadPanelBarItem to show the content of Example1View.xaml or Example2View.xaml.
I want to make the code in NavigationPaneView.xaml like this:
in NavigationPaneViewModel.cs:
and
in Example1ViewModel.cs: (Example2ViewModel.cs is the same)
Because I'm a newbie for Telerik and CM. So I totally have no idea now. Can anybody kindly give me some hint or help?
For examples, the following is my code structure:
MyProject.NavigationPane
NavigationPaneView.xaml
NavigationPaneViewModule.cs
MyProject.NavigationItem.Example1
Example1View.xaml (maybe any content)
Example1ViewModel.cs
MyProject.NavigationItem.Example2
Example2View.xaml (maybe any content)
Example2ViewModel.cs
NavigationPaneView.xaml contains the RadPanelBar. I want to use the strength of CM to dynamically create two RadPanelBarItem to show the content of Example1View.xaml or Example2View.xaml.
I want to make the code in NavigationPaneView.xaml like this:
<
Grid
>
<
Grid.Resources
>
<
HierarchicalDataTemplate
x:Key
=
"NavigationItemTemplate"
>
<
ContentControl
cal:View.Model
=
"{Binding }"
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"rootLevelTemplate"
ItemTemplate
=
"{StaticResource NavigationItemTemplate}"
ItemsSource
=
"{Binding }"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
HierarchicalDataTemplate
>
</
Grid.Resources
>
<
telerik:RadPanelBar
x:Name
=
"pBar"
ItemTemplate
=
"{StaticResource rootLevelTemplate}"
ItemsSource
=
"{Binding NavigationItems}"
/>
</
Grid
>
in NavigationPaneViewModel.cs:
public
BindableCollection<INavigationItem> NavigationItems {
get
;
set
; }
and
public
interface
INavigationItem
{
string
Name {
get
; }
}
in Example1ViewModel.cs: (Example2ViewModel.cs is the same)
[Export(
typeof
(INavigationItem)),
ExportMetadata(
"Name"
,
"Example1"
)]
public
class
Example1ViewModel : INavigationItem
{
public
string
Name
{
get
{
return
"Example1"
; }
}
}
Because I'm a newbie for Telerik and CM. So I totally have no idea now. Can anybody kindly give me some hint or help?