Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - How do I properly use IsSharedSizeScope ?

 
 
Old 03-31-2006   #1 (permalink)
Philippe Lavoie


 
 

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

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


Vista Forums 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 Ltd

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