![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Why can't I have a grid inside a datatemplate? The following <DataTemplate DataType="{x:Type src:ApparelProduct}"> <Grid Margin="10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"/> <ColumnDefinition Width="150"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Image Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.RowSpan="3" Grid.ColumnSpan="1" MinWidth="0" MinHeight="0" ClipToBounds="False" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" IsEnabled="True"> <Image.Source> <BitmapImage UriSource="{Binding Path=ImageUri}"/> </Image.Source> </Image> <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Name}" Foreground="{Binding Path=/TemplatedControl}"/> <TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding Path=ShortDescription}" Foreground="{Binding Path=/TemplatedControl}"/> <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Price}" Foreground="{Binding Path=/TemplatedControl}"/> </Grid> </DataTemplate> Returns the lovely error: Error at element 'Grid' in markup file '' : The property 'ColumnDefinitions' cannot be set as a property element on Template. Only Triggers and Resources are allowed as property elements. Line 106 Position 6. How can I do the above? Phil |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Why can't I have a grid inside a datatemplate? If you are using a CTP from before February, then you need to embed the ColumnDefinitions and RowDefintions as direct children of Grid. That is fixed in Feb CTP. "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message news:OHAefIdTGHA.5044@TK2MSFTNGP09.phx.gbl... > The following > > <DataTemplate DataType="{x:Type src:ApparelProduct}"> > <Grid Margin="10"> > <Grid.ColumnDefinitions> > <ColumnDefinition Width="50"/> > <ColumnDefinition Width="150"/> > </Grid.ColumnDefinitions> > <Grid.RowDefinitions> > <RowDefinition Height="*"/> > <RowDefinition Height="*"/> > <RowDefinition Height="*"/> > </Grid.RowDefinitions> > <Image Width="Auto" Height="Auto" HorizontalAlignment="Stretch" > VerticalAlignment="Center" Grid.RowSpan="3" Grid.ColumnSpan="1" > MinWidth="0" MinHeight="0" ClipToBounds="False" Margin="0,0,0,0" > RenderTransformOrigin="0.5,0.5" IsEnabled="True"> > <Image.Source> > <BitmapImage UriSource="{Binding Path=ImageUri}"/> > </Image.Source> > </Image> > > <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Name}" > Foreground="{Binding Path=/TemplatedControl}"/> > <TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" > Text="{Binding Path=ShortDescription}" Foreground="{Binding > Path=/TemplatedControl}"/> > <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Price}" > Foreground="{Binding Path=/TemplatedControl}"/> > </Grid> > </DataTemplate> > > > Returns the lovely error: > > Error at element 'Grid' in markup file '' : The property > 'ColumnDefinitions' cannot be set as a property element on Template. Only > Triggers and Resources are allowed as property elements. Line 106 Position > 6. > > How can I do the above? > > Phil |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DataTemplate | Billy Jacobs | .NET General | 0 | 05-12-2008 10:36 AM |
| change permission on all files inside a folder or hundreds of file inside a folder | Anthony B | Vista security | 2 | 12-28-2007 04:26 AM |
| Cannot retrieve the visualtree from a datatemplate | Pon | Avalon | 1 | 02-01-2007 08:20 AM |
| What is the difference between DataTemplate and ControlTemplate | Daniel | Avalon | 4 | 05-19-2006 03:19 AM |
| Grid.Row Grid.Column set programatically at runtime | craig kelly-soens www.XpectWorld.com | Avalon | 0 | 01-10-2006 03:52 PM |