![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | How do I properly use IsSharedSizeScope ? Hi, I have the following code. Its goal in life is to show a variable number of products with a header on the top and a total / subtotal section at the bottom. I can't get the line items to line up with the rest, any ideas why? Phil PS Also, the grid lines are dotted, how can I set them to be only black? PS2 here is the relevant code <Canvas> <Canvas.Resources> <Style x:Key="HeaderStyle" TargetType="{x:Type TextBlock}" BasedOn="{x:Null}"> <Setter Property="TextWrapping" Value="NoWrap"/> <Setter Property="TextTrimming" Value="None"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/> </Style> <Style x:Key="TotalStyle" TargetType="{x:Type TextBlock}" BasedOn="{x:Null}"> <Setter Property="TextWrapping" Value="NoWrap"/> <Setter Property="TextTrimming" Value="None"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Right"/> </Style> <Style x:Key="ProductsStyle" TargetType="{x:Type ListBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Grid Grid.IsSharedSizeScope="True"> <!--<Grid.RowDefinitions>--> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <!--</Grid.RowDefinitions>--> <Grid Grid.Row="0" HorizontalAlignment="Center" MinWidth="0" MinHeight="0" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" ShowGridLines="True"> <!--<Grid.ColumnDefinitions>--> <ColumnDefinition Width="*" SharedSizeGroup="DescriptionColumn"/> <ColumnDefinition SharedSizeGroup="CodeColumn"/> <ColumnDefinition SharedSizeGroup="QuantityColumn"/> <ColumnDefinition SharedSizeGroup="UnitPriceColumn"/> <ColumnDefinition SharedSizeGroup="DisountColumn"/> <ColumnDefinition SharedSizeGroup="PriceColumn"/> <!--</Grid.ColumnDefinitions> <Grid.RowDefinitions>--> <RowDefinition /> <!--</Grid.RowDefinitions>--> <TextBlock Style="{DynamicResource HeaderStyle}" Text="Description" Grid.Column="0"/> <TextBlock Style="{DynamicResource HeaderStyle}" Text="Code" Grid.Column="1"/> <TextBlock Style="{DynamicResource HeaderStyle}" Text="Quantity" Grid.Column="2"/> <TextBlock Style="{DynamicResource HeaderStyle}" Text="Unit Price" Grid.Column="3"/> <TextBlock Style="{DynamicResource HeaderStyle}" Text="Discount" Grid.Column="4"/> <TextBlock Style="{DynamicResource HeaderStyle}" Text="Price" Grid.Column="5"/> </Grid> <StackPanel Grid.Row="1" IsItemsHost="True" Orientation="Vertical"/> <Grid Grid.Row="2" HorizontalAlignment="Center" MinWidth="0" MinHeight="0" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5" ShowGridLines="False"> <!--<Grid.ColumnDefinitions>--> <ColumnDefinition SharedSizeGroup="DescriptionColumn"/> <ColumnDefinition SharedSizeGroup="CodeColumn"/> <ColumnDefinition SharedSizeGroup="QuantityColumn"/> <ColumnDefinition SharedSizeGroup="UnitPriceColumn"/> <ColumnDefinition SharedSizeGroup="DisountColumn"/> <ColumnDefinition SharedSizeGroup="PriceColumn"/> <!--</Grid.ColumnDefinitions> <Grid.RowDefinitions>--> <RowDefinition /> <RowDefinition /> <RowDefinition /> <!--</Grid.RowDefinitions>--> <TextBlock Grid.Row="0" Style="{DynamicResource TotalStyle}" Text="Subtotal" Grid.Column="3" Grid.ColumnSpan="2"/> <TextBlock Grid.Row="0" Style="{DynamicResource TotalStyle}" Text="{Binding Path=Subtotal}" Grid.Column="5"/> <TextBlock Grid.Row="1" Style="{DynamicResource TotalStyle}" Text="Tax" Grid.Column="3" Grid.ColumnSpan="2"/> <TextBlock Grid.Row="1" Style="{DynamicResource TotalStyle}" Text="{Binding Path=Tax}" Grid.Column="5"/> <TextBlock Grid.Row="2" Style="{DynamicResource TotalStyle}" Text="{Binding Path=Products.Count}" Grid.Column="2"/> <TextBlock Grid.Row="2" Style="{DynamicResource TotalStyle}" Text="Total" Grid.Column="3" Grid.ColumnSpan="2"/> <TextBlock Grid.Row="2" Style="{DynamicResource TotalStyle}" Text="{Binding Path=Total}" Grid.Column="5"/> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <DataTemplate x:Key="LineItemTemplate"> <Grid ShowGridLines="True"> <ColumnDefinition SharedSizeGroup="DescriptionColumn"/> <ColumnDefinition SharedSizeGroup="CodeColumn"/> <ColumnDefinition SharedSizeGroup="QuantityColumn"/> <ColumnDefinition SharedSizeGroup="UnitPriceColumn"/> <ColumnDefinition SharedSizeGroup="DisountColumn"/> <ColumnDefinition SharedSizeGroup="PriceColumn"/> <RowDefinition/> <TextBlock x:Name="data0" Grid.Column="0" Grid.Row="0" Margin="10,0,10,0" Text="{Binding Path=SelectedSku.Name}"/> <TextBlock x:Name="data1" Grid.Column="1" Grid.Row="0" Margin="10,0,10,0" Text="{Binding Path=SelectedSku.Sku}"/> <TextBlock x:Name="data2" Grid.Column="2" Grid.Row="0" Margin="10,0,10,0" Text="{Binding Path=Quantity}"/> <TextBlock x:Name="data3" Grid.Column="3" Grid.Row="0" Margin="10,0,10,0" Text="{Binding Path=UnitPrice}"/> <TextBlock x:Name="data4" Grid.Column="4" Grid.Row="0" Margin="10,0,10,0" Text="{Binding Path=Discount}"/> <TextBlock x:Name="data5" Grid.Column="5" Grid.Row="0" Margin="10,0,10,0" Text="{Binding Path=Price}"/> </Grid> </DataTemplate> </Canvas.Resources> <StackPanel Orientation="Vertical" Canvas.Left="0" Canvas.Top="16"> <Grid Grid.IsSharedSizeScope="True"> <ListBox ItemsSource="{Binding Path=Products}" ItemTemplate="{StaticResource LineItemTemplate}" Style="{StaticResource ProductsStyle}"/> </Grid> </StackPanel> </Canvas> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Is this working properly? | Vista networking & sharing | |||
| Won't start up properly | Vista General | |||
| Not properly installed. | Vista mail | |||
| Cam won't work properly | Vista hardware & devices | |||
| How to use [datetime]::now properly? | PowerShell | |||