CloseRadWindow TriggerAction

2 posts, 0 answers
  1. Joseph Gershgorin
    Joseph Gershgorin avatar
    28 posts
    Member since:
    Aug 2009

    Posted 25 Sep 2009 Link to this post

    I found it a little annoying that I had to drop to code behind to just have a button do nothing more than close a RadWindow it. It's fairly easy to encapsulate this into TriggerAction.

    For this to work you should have installed and referenced System.Windows.Interactivity from the Blend 3 SDK.

    Here's the Behavior:
    using System.Windows; 
    using System.Windows.Interactivity; 
    using Telerik.Windows.Controls; 
    namespace Mass.ThirdParty.Telerik.Behaviors 
        public class CloseRadWindowTriggerAction : TriggerAction<FrameworkElement> 
            protected override void Invoke(object parameter) 
                var radWindow = RadWindow.GetParentRadWindow(AssociatedObject); 
                if (radWindow != null

    And here's how to use it in XAML:
    <Button Content="Close"
            <i:EventTrigger EventName="Click"
                <Behaviors:CloseRadWindowTriggerAction /> 

  2. Miroslav Nedyalkov
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 Sep 2009 Link to this post

    Hello Joseph,

    Thank you for sharing your thoughts! If the button that should close the RadWindow is within the RadWindow control you may use "out of the box" the following approach to achieve the same result:
    <Button Content="Close!"
                <telerik:MouseBinding Gesture="LeftClick" 
                        Command="telerik:WindowCommands.Close" /> 

    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
Back to Top