This question is locked. New answers and comments are not allowed.
Hello,
I think that I have found a small problem and I need to find a workaround for it. I have a RadWindow inside a page of my application and I have also assigned via 'code' the WindowClosed event as:
My problem is that the window calls the event handler before even the close animation finishes and the window gets totally closed. For this reason, I can not open an other RadWindow straight at that time. Am I doing something wrong?
I couldn't attach a zip file of a demo project that displayes that weird behavior so I copy the code here (sorry about that).
MainPage.xaml.cs -> Contains only a button
QuestionDialog.xaml
QuestionDialog.xaml.cs
Thank you very much.
Efthymios Kalyviotis
I think that I have found a small problem and I need to find a workaround for it. I have a RadWindow inside a page of my application and I have also assigned via 'code' the WindowClosed event as:
dlg =
new
WizardDialog();
dlg.window.WindowClosed +=
new
EventHandler<Telerik.Windows.Controls.WindowClosedEventArgs>(wizardWindow_WindowClosed);
My problem is that the window calls the event handler before even the close animation finishes and the window gets totally closed. For this reason, I can not open an other RadWindow straight at that time. Am I doing something wrong?
I couldn't attach a zip file of a demo project that displayes that weird behavior so I copy the code here (sorry about that).
MainPage.xaml.cs -> Contains only a button
private
void
button1_Click(
object
sender, RoutedEventArgs e)
{
QuestionDialog dlg =
new
QuestionDialog();
dlg.window.WindowClosed +=
new
EventHandler<Telerik.Windows.Controls.WindowClosedEventArgs>(window_WindowClosed);
dlg.CaptionTextBlock.Text =
"Question"
;
dlg.DescrTextBlock.Text =
"Do you like apples?"
;
dlg.window.IsOpen =
true
;
}
void
window_WindowClosed(
object
sender, Telerik.Windows.Controls.WindowClosedEventArgs e)
{
QuestionDialog dlg =
new
QuestionDialog();
dlg.window.WindowClosed +=
new
EventHandler<Telerik.Windows.Controls.WindowClosedEventArgs>(window_WindowClosed);
dlg.CaptionTextBlock.Text =
"Question"
;
dlg.DescrTextBlock.Text =
"Do you red apples?"
;
dlg.window.IsOpen =
true
;
//throw new NotImplementedException();
}
QuestionDialog.xaml
<
UserControl
x:Class
=
"MyRadWindow.QuestionDialog"
xmlns:telerikCore
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Core"
xmlns:telerikPrimitives
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
mc:Ignorable
=
"d"
FontFamily
=
"{StaticResource PhoneFontFamilyNormal}"
FontSize
=
"{StaticResource PhoneFontSizeNormal}"
Foreground
=
"{StaticResource PhoneForegroundBrush}"
d:DesignHeight
=
"480"
d:DesignWidth
=
"480"
>
<
Grid
x:Name
=
"LayoutRoot"
Height
=
"346"
Width
=
"336"
>
<
telerikPrimitives:RadModalWindow
x:Name
=
"window"
Placement
=
"CenterCenter"
Canvas.ZIndex
=
"2"
>
<
telerikPrimitives:RadModalWindow.OpenAnimation
>
<
telerikCore:RadPlaneProjectionAnimation
CenterY
=
"0.5"
CenterX
=
"0"
StartAngleX
=
"-90"
EndAngleX
=
"0"
Axes
=
"X"
>
<
telerikCore:RadPlaneProjectionAnimation.Easing
>
<
CubicEase
EasingMode
=
"EaseOut"
/>
</
telerikCore:RadPlaneProjectionAnimation.Easing
>
</
telerikCore:RadPlaneProjectionAnimation
>
</
telerikPrimitives:RadModalWindow.OpenAnimation
>
<
Border
BorderThickness
=
"{StaticResource PhoneBorderThickness}"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
BorderBrush
=
"#BFFF0000"
>
<
Grid
Background
=
"#FFC24A4A"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
StackPanel
Grid.ColumnSpan
=
"2"
Background
=
"Red"
>
<
TextBlock
x:Name
=
"CaptionTextBlock"
TextWrapping
=
"Wrap"
Text
=
"This is a caption"
Margin
=
"8,0,0,0"
Foreground
=
"White"
/>
</
StackPanel
>
<
TextBlock
x:Name
=
"DescrTextBlock"
Grid.Row
=
"1"
Grid.ColumnSpan
=
"2"
HorizontalAlignment
=
"Stretch"
TextWrapping
=
"Wrap"
Text
=
"description"
Foreground
=
"#FFFFF1F1"
Margin
=
"8,0"
/>
<
Button
x:Name
=
"OKButton"
Grid.Row
=
"3"
Grid.Column
=
"0"
Content
=
"Yes"
Click
=
"OKButton_Click"
BorderBrush
=
"#FFFF4F4F"
Foreground
=
"#FFFFADAD"
/>
<
Button
x:Name
=
"CancelButton"
Grid.Row
=
"3"
Grid.Column
=
"1"
Content
=
"No"
Click
=
"CancelButton_Click"
BorderBrush
=
"#FFFF4F4F"
Foreground
=
"#FFFFADAD"
/>
</
Grid
>
</
Border
>
</
telerikPrimitives:RadModalWindow
>
</
Grid
>
</
UserControl
>
QuestionDialog.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;
namespace
MyRadWindow
{
public
partial
class
QuestionDialog : UserControl
{
public
Boolean bOKPressed =
false
;
public
QuestionDialog()
{
InitializeComponent();
window.WindowSize =
new
Size(
Application.Current.RootVisual.RenderSize.Width,
Application.Current.RootVisual.RenderSize.Height
);
}
private
void
OKButton_Click(
object
sender, RoutedEventArgs e)
{
bOKPressed =
true
;
this
.window.IsOpen =
false
;
}
private
void
CancelButton_Click(
object
sender, RoutedEventArgs e)
{
bOKPressed =
false
;
this
.window.IsOpen =
false
;
}
}
}
Thank you very much.
Efthymios Kalyviotis