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

Window + DataBinding + ItemsControl

2 Answers 75 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 17 Sep 2009, 12:20 PM
My requirements are to have a dashboard like experience utilizing windows so that users can move these windows around the screen as they see fit.

The setup is very MVVM... instead of adding windows through code I have been trying to utilize an items control bound to my list of "windows". This items controls' generated item template is a RadWindow.

1. The windows never appear.
2. If I call 'Show' in the windows loaded event I get an exception stating that the window can have only one parent.
3. I know the test case is sound as when I utilize a simple stack panel in the item template all is well.

question... is Window + DataBinding + ItemsControl possible?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 23 Sep 2009, 03:13 PM
Hello Mark,

Could you please share some code with us so that we can try to reproduce the problem and resolve it? I tried the code snippet bellow and it seemed to be working fine.

 <ItemsControl x:Name="itemsControl"
            <ItemsControl.ItemTemplate> 
                <DataTemplate> 
                    <StackPanel> 
                        <telerikNavigation:RadWindow Loaded="RadWindow_Loaded"
                            <Button Content="some content" Width="100" Height="25" /> 
                        </telerikNavigation:RadWindow> 
                    </StackPanel> 
                </DataTemplate> 
            </ItemsControl.ItemTemplate> 
        </ItemsControl> 
private void RadWindow_Loaded(object sender, System.Windows.RoutedEventArgs e) 
        { 
            var window = sender as RadWindow; 
            window.Show(); 
        } 

What am I missing?

Kind regards,
Kaloyan
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.
0
Mark
Top achievements
Rank 1
answered on 23 Sep 2009, 07:33 PM
Interesting... not sure if it was the solution but having wrapped the window in a stackpanel is what fixes the issue. (a hint from you example).

works now!
Tags
Window
Asked by
Mark
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Mark
Top achievements
Rank 1
Share this question
or