![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | 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) |
| | 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 | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| DataTemplate | .NET General | |||