Hello,
I am having some trouble while using the RadTransition control. The way i am using it is below:
Then using a frame control as below on the page:
Then in the Viewmodel for this page:
Now i can navigate to the UserIconView and UserListView pages, thats nto a problem. The problem is that when i transition to any of these pages, in the code-behind, i have 2 constructors defined like this:
The problem is that it only hits the Default constructor, the second user defined constructor is not fired at all, so basically i am not able to access my view model for these views.
Any help would be appreciated.
I am having some trouble while using the RadTransition control. The way i am using it is below:
<
UserControl.Resources
>
<
Style
x:Key
=
"TransitionFrameStyle"
TargetType
=
"sdk:Frame"
>
<
Setter
Property
=
"Background"
Value
=
"Transparent"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"sdk:Frame"
>
<
Border
CornerRadius
=
"5"
>
<
Grid
Background
=
"{TemplateBinding Background}"
>
<
telerik:RadTransitionControl
x:Name
=
"PART_FrameCP"
Content
=
"{TemplateBinding Content}"
ContentTemplate
=
"{TemplateBinding ContentTemplate}"
>
<
telerik:RadTransitionControl.Transition
>
<
TransitionEffects:SlideAndZoomTransition
MinAlpha
=
"0.1"
MinZoom
=
"0.9"
SlideDirection
=
"LeftToRight"
StartSlideAt
=
"0.25"
/>
</
telerik:RadTransitionControl.Transition
>
</
telerik:RadTransitionControl
>
<
Border
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Padding
=
"{TemplateBinding Padding}"
/>
</
Grid
>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
UserControl.Resources
>
Then using a frame control as below on the page:
<
sdk:Frame
Style
=
"{StaticResource TransitionFrameStyle}"
Grid.Row
=
"1"
NavigationFailed
=
"Frame_NavigationFailed"
Source
=
"{Binding Path=SelectedPage.PageUri}"
/>
Then in the Viewmodel for this page:
private
readonly
ObservableCollection<FramePage> pages;
public
UserManagementSummaryViewModel(IRegionManager regionManager)
{
if
(regionManager ==
null
)
{
throw
new
ArgumentNullException(
"regionManager"
);
}
this
.regionManager = regionManager;
this
.BackCommand =
new
DelegateCommand(
this
.NavigateToMainScreen);
this
.RefreshCommand =
new
DelegateCommand(
this
.RefreshUserPanel);
this
.ShowIconViewCommand =
new
DelegateCommand(
this
.ShowIconView);
this
.ShowListViewCommand =
new
DelegateCommand(
this
.ShowListView);
this
.pages =
new
ObservableCollection<FramePage>();
pages.Add(
new
FramePage(
"Icon View"
,
"/XYZ.UserManagementModule;component/Views/UserIconView.xaml"
));
pages.Add(
new
FramePage(
"List View"
,
"/XYZ.UserManagementModule;component/Views/UserListView.xaml"
));
//// Set the default view to the Icons View page
this
.SelectedPage =
this
.pages[0];
}
/// <summary>
/// Gets or sets the selected page to display in the frame
/// </summary>
public
FramePage SelectedPage
{
get
{
return
GetProperty(() =>
this
.SelectedPage);
}
set
{
SetProperty(() =>
this
.SelectedPage, value);
}
}
/// <summary>
/// Gets the pages collection that can be displayed in the transition frame
/// </summary>
public
ObservableCollection<FramePage> Pages
{
get
{
return
this
.pages;
}
}
/// <summary>
/// Shows the Icon view page in the transition frame
/// </summary>
private
void
ShowIconView()
{
this
.SelectedPage =
this
.pages[0];
}
/// <summary>
/// Shows the List view page in the transition frame
/// </summary>
private
void
ShowListView()
{
this
.SelectedPage =
this
.pages[1];
}
Now i can navigate to the UserIconView and UserListView pages, thats nto a problem. The problem is that when i transition to any of these pages, in the code-behind, i have 2 constructors defined like this:
/// <summary>
/// Initializes a new instance of the <see cref="UserListView"/> class.
/// </summary>
public
UserListView()
{
this
.InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the <see cref="UserListView"/> class.
/// </summary>
/// <param name="userManagementViewModel">View model for <see cref="UserListView"/></param>
public
UserListView(UserManagementViewModel userManagementViewModel)
:
this
()
{
this
.DataContext = userManagementViewModel;
}
The problem is that it only hits the Default constructor, the second user defined constructor is not fired at all, so basically i am not able to access my view model for these views.
Any help would be appreciated.