This is a migrated thread and some comments may be shown as answers.

Windows getting focus

5 Answers 125 Views
Window
This is a migrated thread and some comments may be shown as answers.
Nic
Top achievements
Rank 1
Nic asked on 05 Feb 2009, 03:11 PM
Hi,

For our MDI app, I'd like it so that windows can display their visual focus state. Do the RadWindows expose any templates (focused/unfocused) for this?

Specifically, the case is multiple windows on the screen. One window has the active focus, and is visually highlighted from the rest. This window may partially obscure another. When the obscured window's content region/window border is clicked, it will become the active focused window and popup in front so that it is no longer obscured.

I am having an issue implementing this and would appreciate pointers/code sample on how to capture the focus when any item in the window's content is clicked. How does one go about capturing the focus event from any item, and bubbling it to the containing window and then changing the visual template. The same likewise for losing focus and also for clicking on the window's borders.

Thanks,
Nic

5 Answers, 1 is accepted

Sort by
0
Hristo Borisov
Telerik team
answered on 05 Feb 2009, 06:42 PM
Hi Nic,

We had this functionality in our first releases of the control, but since there are some problems with the focus of popup controls introduced by the Silverlight framework, we had decided to obscure this functionality until we find some workaround. We will do our best to include that with our next release. Until then you can use a workaround to our missing implementation of handling focus states like this.


    class TestWindow : RadWindow  
    {  
        public TestWindow()  
        {  
            this.BorderBackground = new SolidColorBrush(Colors.Blue);  
        }  
 
        protected override void OnGotFocus(RoutedEventArgs e)  
        {  
            base.OnGotFocus(e);  
            this.BorderBackground = new SolidColorBrush(Colors.Red);  
 
        }  
 
        protected override void OnLostFocus(RoutedEventArgs e)  
        {  
            base.OnLostFocus(e);  
            this.BorderBackground = new SolidColorBrush(Colors.Blue);  
        }  
    } 

The colors are just an obvious example, so you can play with this however you like. Thank you for contacting us, and feel free to contact us for any futher support.

Sincerely yours,
Hristo Borisov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nic
Top achievements
Rank 1
answered on 06 Feb 2009, 10:01 PM
Hristo,

Thank you once again. I had been thinking of template parts for focus/lost focus for the window but this solution works just fine for now.

Incidentally, for customizing the windows, in a previous post I think it was mentioned that the window's template parts would be updated and/or documented, and made available for end user customization. Is that going to be in the next release of the silverlight controls and do we have a timeframe of this release?

I'd like to add additional widgets/buttons alongside the pin/minimize/maximise/close buttons, and am thinking that modifying the corresponding template part would be the way to go. Is this something I can do now or can do once the next release becomes available?

Thanks again.
Nic

0
Miroslav Nedyalkov
Telerik team
answered on 10 Feb 2009, 04:53 PM
Hello Nic,

The template of the window is currently available for customizations. I am attaching an example of how to change the template of the window control.

Best wishes,
Miroslav Nedyalkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nic
Top achievements
Rank 1
answered on 10 Feb 2009, 10:09 PM
Hi Miroslav,

Thanks for the example with the control template. I'm now able to add my own buttons next to the pin, minimise, maximise and close buttons, and hook those up. It's exactly what I was hoping to get.

Regarding two window, with one obscuring the other I notice that if I click on the window border of the obscured window, it will receive focus and popup in front of the other window.

However, if I just click on the window content of the obscured window, then it receives focus but does not popup in front. Is there a way to get this to work as if I had clicked the window border?

I know Hristo mentioned there were issues with the focus in his post above. Wondering if this is that issue or is there something else?

Thanks,
Nic

0
Miroslav Nedyalkov
Telerik team
answered on 12 Feb 2009, 10:16 AM
Hello Nic,

Actually, this is the expected behavior of RadWindow. As Hristo mentioned, there are  some problems with the focus and the Z-ordering of the popup controls introduced by the Silverlight framework and we decided to cut this functionality down. We will continue our research to improve the mechanism and implement it back in the control.

Sincerely yours,
Miroslav Nedyalkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Nic
Top achievements
Rank 1
Answers by
Hristo Borisov
Telerik team
Nic
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or