
LE DREAU Steeve
Top achievements
Rank 1
LE DREAU Steeve
asked on 13 May 2011, 10:38 AM
Hi,
I would like to be able to prevent clicking on the top right cross button to avoid closing the popup in certain conditions.
But in window, I have another button that can close the popup without testing this condition.
So I have tested using PreviewClosed event, but I can't know if I clicked on the top right cross button or if I have clicked on my button that have to close the popup.
Is there a way to do this please ?
Thanks
Steeve
I would like to be able to prevent clicking on the top right cross button to avoid closing the popup in certain conditions.
But in window, I have another button that can close the popup without testing this condition.
So I have tested using PreviewClosed event, but I can't know if I clicked on the top right cross button or if I have clicked on my button that have to close the popup.
Is there a way to do this please ?
Thanks
Steeve
6 Answers, 1 is accepted
0
Hi Steeve,
Here is what you can do:
1. Raise a flag if you are going to close the Window via the button that you have added.
2. Change the template of the RadWindow and instead of the Close command use the Click event of the Close button. You can easily do this in Expression Blend. Just drop a RadWindow control on the design surface, right-click it and choose from the menu Edit Template-> Edit a Copy. Then, Blend will generate all the needed resources.
Hope this information helps.
Best wishes,
Konstantina
the Telerik team
Here is what you can do:
1. Raise a flag if you are going to close the Window via the button that you have added.
2. Change the template of the RadWindow and instead of the Close command use the Click event of the Close button. You can easily do this in Expression Blend. Just drop a RadWindow control on the design surface, right-click it and choose from the menu Edit Template-> Edit a Copy. Then, Blend will generate all the needed resources.
Hope this information helps.
Best wishes,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

LE DREAU Steeve
Top achievements
Rank 1
answered on 16 May 2011, 11:17 AM
Thanks for your answer but when I've changed the command, how can I handle it ?
I've made a class that inherits from radwindow to add custom behaviors, so I would like to handle the click event into it. Do you have a clue about that please ?
Thanks
I've made a class that inherits from radwindow to add custom behaviors, so I would like to handle the click event into it. Do you have a clue about that please ?
Thanks
0

LE DREAU Steeve
Top achievements
Rank 1
answered on 16 May 2011, 11:30 AM
here is what I've done :
I've changed the .Close command to .Click on the PART_Closebutton control into the template.
Into my class, i've written this code :
And I have the ButtonCloseClicked event fired.
But the popup is still closed by this button. How can I prevent the popup to be closed ?
Thanks
I've changed the .Close command to .Click on the PART_Closebutton control into the template.
Into my class, i've written this code :
Private
WithEvents
_ButtonClose
As
Button
Public
Overrides
Sub
OnApplyTemplate()
MyBase
.OnApplyTemplate()
_ButtonClose =
Me
.GetTemplateChild(
"PART_CloseButton"
)
End
Sub
Private
Sub
ButtonCloseClicked()
Handles
_ButtonClose.Click
End
Sub
And I have the ButtonCloseClicked event fired.
But the popup is still closed by this button. How can I prevent the popup to be closed ?
Thanks
0
Hello Steeve,
I had something else in mind, however since you started this way, all you need to do now is to set the Command property of the
Please let us know if that worked for you.
Regards,
Konstantina
the Telerik team
I had something else in mind, however since you started this way, all you need to do now is to set the Command property of the
_ButtonClose
to null:
_ButtonClose.Command =
Nothing
Please let us know if that worked for you.
Regards,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

LE DREAU Steeve
Top achievements
Rank 1
answered on 17 May 2011, 11:24 AM
Hi,
Thanks for your answer but it doesn't work.
I've tried it into a simple project :
I've created a class like this :
I open my popup and then click on the close button but the popup is still closed.
Thanks for your answer but it doesn't work.
I've tried it into a simple project :
I've created a class like this :
Imports
Telerik.Windows.Controls
Public
Class
MyPopup
Inherits
RadWindow
Private
_ButtonClose
As
Button
Public
Overrides
Sub
OnApplyTemplate()
MyBase
.OnApplyTemplate()
_ButtonClose =
Me
.GetTemplateChild(
"PART_CloseButton"
)
If
_ButtonClose IsNot
Nothing
Then
_ButtonClose.Command =
Nothing
End
If
End
Sub
End
Class
I open my popup and then click on the close button but the popup is still closed.
0
Hello Steeve,
I tried this code:
And it works fine. Could you please prepare us an example that demonstrates the issue and send us via support ticket?
Greetings,
Miroslav Nedyalkov
the Telerik team
I tried this code:
Private
Sub
Button_Click(sender
As
Object
, e
As
RoutedEventArgs)
Dim
w
As
New
MyWindow()
w.Show()
End
Sub
Private
Class
MyWindow
Inherits
RadWindow
Public
Overrides
Sub
OnApplyTemplate()
MyBase
.OnApplyTemplate()
TryCast(
Me
.GetTemplateChild(
"PART_CloseButton"
), RadButton).Command =
New
DelegateCommand(
Function
(o)
End
Function
)
End
Sub
End
Class
And it works fine. Could you please prepare us an example that demonstrates the issue and send us via support ticket?
Greetings,
Miroslav Nedyalkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items