![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | ItemControl broken? When I run the following XAML, I get: - An exception; or - A infinite loop (100% CPU, no workingset delta) <ItemsControl Grid.Row="2" Margin="5,5,5,5" ItemsSource="{Binding Path=Attributes}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> *** <Rectangle Height="100" Width="20" Fill="Red" /> </StackPanel> etc. Here is the wierd part: if I remove the <StackPanel> ***, it works fine. Any thoughts? |
My System Specs![]() |
| | #2 (permalink) |
| | RE: ItemControl broken? One thing I forgot to mention, is that XAMLPad runs it fine - works, no exceptions of CPU saturation. Wierd huh. -- Regards, Fil. |
My System Specs![]() |
| | #3 (permalink) |
| | RE: ItemControl broken? OK, here is the really wierd part. This version works fine: <ItemsControl Grid.Row="2" Margin="5,0,5,5" ItemsSource="{Binding Path=Attributes}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Grid/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> ... but if "<Grid/>" gets split out into "<Grid><Grid/>" then it breaks. For the record, under VS2005 there is an exception thrown: "Object reference not set to an instance of an object." at - public static void Main() { System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.STA); XmlViewer2.MyApp app = new XmlViewer2.MyApp(); app.InitializeComponent(); app.Run(); // <== exception thrown here } ... not very helpful. All forms work under XAMLPad, but they dont under EID - due to other necessary parts of the XAML that the designer can't handle at this stage. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: ItemControl broken? ummm... do you mean <grid></grid> and not <grid><grid/>? The latter leaves an unclosed <grid> tag. "Fil Mackay" <FilMackay@discussions.microsoft.com> wrote in message news:85B11D46-30C7-4557-88D7-3046BFFA206D@microsoft.com... > OK, here is the really wierd part. This version works fine: > > <ItemsControl Grid.Row="2" Margin="5,0,5,5" > ItemsSource="{Binding Path=Attributes}"> > <ItemsControl.ItemsPanel> > <ItemsPanelTemplate> > <StackPanel Orientation="Vertical" /> > </ItemsPanelTemplate> > </ItemsControl.ItemsPanel> > <ItemsControl.ItemTemplate> > <DataTemplate> > <Grid/> > </DataTemplate> > </ItemsControl.ItemTemplate> > </ItemsControl> > > .. but if "<Grid/>" gets split out into "<Grid><Grid/>" then it breaks. > For > the record, under VS2005 there is an exception thrown: "Object reference > not > set to an instance of an object." at - > > public static void Main() { > > System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.STA); > XmlViewer2.MyApp app = new XmlViewer2.MyApp(); > app.InitializeComponent(); > app.Run(); // <== exception thrown here > } > > .. not very helpful. > > All forms work under XAMLPad, but they dont under EID - due to other > necessary parts of the XAML that the designer can't handle at this stage. > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: ItemControl broken? "Winthrop Chan" wrote: > ummm... do you mean <grid></grid> and not <grid><grid/>? The latter leaves > an unclosed <grid> tag. Errk.. um.. yes. (it did parse both times ![]() |
My System Specs![]() |
| | #6 (permalink) |
| | Re: ItemControl broken? I had the exact same behavior while replacing the ItemsPanel on a StackPanel... The syntaxt thing about where the / goes is not relevant in this case however... In my case, I received an error indicating that the DataTemplate could only have one child... When I tried out of the blue to put <WrapPanel />, it started working... I am wondering if it could not mean that the space between <WrapPanel> and <WrapPanel> is somehow interpretted for the ItemTemplate as a "Children"(Children is the default content property for the Panel classes) element while nothing is assigned to the "content" when <WrapPanel /> notation is used (this is a wild guess, and your opinion is welcomed)... Marcus |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Help! I think it's broken. | Vista installation & setup | |||
| broken | Vista General | |||
| Lots of problems - regedit is broken, taskbar is misbehaving, audio is broken.. HELP! | Vista General | |||
| ICS is Broken | Vista General | |||
| IE7 and WMP Broken! | Vista performance & maintenance | |||