Reputation: 2178
Why does this listbox crash on windows XP and not Vista or windows 7,
The it builds fine without error but when iam trying to run it in xp in crashed and i get this error.. System.FormatExeption
<ListBox Name="lvMyAssignments" ScrollViewer.VerticalScrollBarVisibility="Hidden" Height="280" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Margin="0,3,0,0" Tag="{Binding Path=Plocklista}" Background="Transparent" Click="Open_Assignment">
<StackPanel>
<Border BorderBrush="Black" BorderThickness="1,1,1,0">
<Border.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}" Value="True">
<Setter Property="Border.Height" Value="100"/>
<Setter Property="Border.Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
<GradientStop Color="DarkGray" Offset="1"/>
<GradientStop Color="#FFE8E8E8"/>
<GradientStop Color="#FFBDBDBD" Offset="0.153"/>
<GradientStop Color="DarkGray" Offset="0.904"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
<GradientStop Color="#FFECECEC" Offset="1"/>
<GradientStop Color="#FFE8E8E8"/>
<GradientStop Color="#FFBDBDBD" Offset="0.153"/>
<GradientStop Color="#FFE8E8E8" Offset="0.904"/>
</LinearGradientBrush>
</Border.Background>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Border BorderBrush="Darkgray" BorderThickness="0,0,1,0">
<DockPanel Width="555">
<ItemsControl Height="70" ItemsSource="{Binding Path=Descriptions}" Background="Transparent" BorderThickness="0" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="{Binding Path=Value}"/>
<TextBlock FontWeight="Bold" Margin="5,0,0,0" Text="{Binding Path=Key}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DockPanel>
</Border>
<StackPanel HorizontalAlignment="Center">
<StackPanel.Background>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<LinearGradientBrush.RelativeTransform>
<TransformGroup>
<TranslateTransform X="-0.5" Y="-0.5"/>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="90"/>
<TranslateTransform X="0.5" Y="0.5"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</LinearGradientBrush.RelativeTransform>
<GradientStop Color="sc#1, 1, 0.158960834, 0.004391442" Offset="0"/>
<GradientStop Color="sc#1, 1, 0.5, 0.5" Offset="1"/>
</LinearGradientBrush>
</StackPanel.Background>
<StackPanel HorizontalAlignment="Center">
<StackPanel.Background>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<LinearGradientBrush.RelativeTransform>
<TransformGroup>
<TranslateTransform X="-0.5" Y="-0.5"/>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="90"/>
<TranslateTransform X="0.5" Y="0.5"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</LinearGradientBrush.RelativeTransform>
<GradientStop Color="sc#1, 1, 0.158960834, 0.004391442" Offset="0"/>
<GradientStop Color="sc#1, 1, 0.5, 0.5" Offset="1"/>
</LinearGradientBrush>
</StackPanel.Background>
<TextBlock Text="{Binding Path=Antal}" TextAlignment="Center" Width="100" FontSize="44pt" FontFamily="Calibri"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
Upvotes: 0
Views: 367
Reputation: 62919
The only thing I see in your XAML that might be affected by OS version is Font="Calibri"
, since XP will have different fonts installed than Vista / Win7, and WPF has its own font handling. Maybe that is it, but probably not.
I suggest you post a stack trace of the FormatException you get. This might give some real clues. Also try to boil down your XAML to the mimimum necessary to give the error. Then we will be more likely to see it.
Upvotes: 1