Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

ItemControl broken?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-14-2006   #1 (permalink)
Fil Mackay
Guest


 

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 SpecsSystem Spec
Old 03-14-2006   #2 (permalink)
Fil Mackay
Guest


 

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 SpecsSystem Spec
Old 03-15-2006   #3 (permalink)
Fil Mackay
Guest


 

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 SpecsSystem Spec
Old 03-15-2006   #4 (permalink)
Winthrop Chan
Guest


 

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 SpecsSystem Spec
Old 03-15-2006   #5 (permalink)
Fil Mackay
Guest


 

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 SpecsSystem Spec
Old 03-15-2006   #6 (permalink)
Marcus
Guest


 

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 SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lots of problems - regedit is broken, taskbar is misbehaving, audio is broken.. HELP! Elspeth Vista General 3 07-02-2008 05:19 PM
SP1 seems to have broken WMP 11 David Vista General 19 05-27-2008 06:50 PM
ICS is Broken Brad Vista General 1 03-26-2008 01:26 PM
IE7 and WMP Broken! Ray Vista performance & maintenance 0 06-09-2007 01:53 PM
broken icons Rodolfo Vista General 4 04-11-2007 04:22 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51