2009-07-20 24 views
1

Ich habe einen Stil bekam:ListBox arbeiten WPF aber nicht auf Silverlight

<Style x:Key="StarPathStyle" TargetType="Path"> 
      <Setter Property="StrokeThickness" Value="1"/> 
      <Setter Property="Stroke" Value="#FF000080"/> 
      <Setter Property="StrokeStartLineCap" Value="Round"/> 
      <Setter Property="StrokeEndLineCap" Value="Round"/> 
      <Setter Property="StrokeLineJoin" Value="Round"/> 
      <Setter Property="StrokeMiterLimit" Value="1"/>  
      <Setter Property="Data" Value="F1 M 145.637,174.227L 127.619,110.39L 180.809,70.7577L 114.528,68.1664L 93.2725,5.33333L 70.3262,67.569L 4,68.3681L 56.0988,109.423L 36.3629,172.75L 91.508,135.888L 145.637,174.227 Z"/> 
      <Setter Property="Fill" Value="#FFFFFF00"> 
     </Setter> 
    </Style> 

Und eine ListBox, die ein paar Artikel zeigt:

<ListBox Background="LightGray" Margin="8,171.5,8,8"> 
     <ListBox.ItemsPanel> 
      <ItemsPanelTemplate> 
       <StackPanel Orientation="Horizontal"/> 
      </ItemsPanelTemplate> 
     </ListBox.ItemsPanel> 

      <Button Content="Hello" /> 
      <Path Style="{StaticResource StarPathStyle}" /> 
      <Ellipse Width="10" Height="20" Fill="Blue" /> 
      <Ellipse Width="20" Height="10" Fill="Blue" /> 
      <Path Style="{StaticResource StarPathStyle}" /> 
     </ListBox> 

Frage: Warum es auf WPF funktioniert aber nicht auf Silverlight 3.0?

Auf Silveright es gibt "Argument" besagt, dass "Wert nicht innerhalb des erwarteten Bereichs fällt."

.pom.

Antwort

0

Nicht wirklich sicher, aber ich durch Bewegen des „Data“ aus der Styling Ressource und in die XAML-Datei gefunden, es funktioniert:

<Path Style="{StaticResource StarPathStyle}" 
Data="F1 M 145.637,174.227L 127.619,110.39L 180.809,70.7577L 114.528,68.1664L 93.2725,5.33333L 70.3262,67.569L 4,68.3681L 56.0988,109.423L 36.3629,172.75L 91.508,135.888L 145.637,174.227 Z" />