RadWindow using DataEventTrigger

2 posts, 0 answers
  1. Mark Shortt
    Mark Shortt avatar
    22 posts
    Member since:
    Jan 2010

    Posted 02 Aug 2011 Link to this post


    I'm evaluating using RadWindow for our Silverlight  / MVVM project.

    Is there a way to call the showDialog and Close events from XAML?

    I'm looking to use a solution similar to the answer to the following question



  2. Miroslav Nedyalkov
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 04 Aug 2011 Link to this post

    Hello Mark,

     The Window control is not designed to be placed in XAML so we designed its API to work from C# code using the Show/ShowDialog and Close methods. If you need a property which can open and close the Window you could create an attached one to do the work in its PropertyChanged callback. Please refer to the following example:

    public static bool GetIsOpen(DependencyObject obj)
        return (bool)obj.GetValue(IsOpenProperty);
    public static void SetIsOpen(DependencyObject obj, bool value)
        obj.SetValue(IsOpenProperty, value);
    public static readonly DependencyProperty IsOpenProperty =
        DependencyProperty.RegisterAttached("IsOpen", typeof(bool), typeof(WindowTest), new PropertyMetadata(OnIsOpenPropertyChanged));
    private static void OnIsOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        var window = d as RadWindow;
        if (window != null)
            if ((bool)e.NewValue)
                window.Closed += OnWindowClosed;
                window.Closed -= OnWindowClosed;
                if (window.IsOpen)
    private static void OnWindowClosed(object sender, WindowClosedEventArgs e)
        SetIsOpen(sender as RadWindow, false);

    Best wishes,

    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top