KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
A have a ListBox of items, every ListBoxItem contains an icon in the form of a Path object, like so: <ListBox.ItemTemplate> <DataTemplate> <Grid ...> ... <Path Margin="4" Style="{StaticResource ErrorIconPath}" Stretch="Uniform" Width="26" Height="26" RenderTransformOrigin="0.5,0.5" Grid.Column="1" Grid.Row="1" UseLayoutRounding="False" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> The Path's style is contained in Appl.xaml ( Application.Resources section) and is the following: <Style x:Key="ErrorIconPath" TargetType="Path"> <Setter Property="Data" Value="F1M874.094,289.369L854.3,254.63C854.028,254.151 853.515,253.856 852.958,253.856 852.403,253.856 851.89,254.151 851.617,254.63L831.824,289.369C831.555,289.84 831.559,290.416 831.835,290.883 832.111,291.348 832.618,291.634 833.165,291.634L872.752,291.634C873.299,291.634 873.805,291.348 874.081,290.883 874.357,290.416 874.361,289.84 874.094,289.369 M855.653,287.189L850.264,287.189 850.264,282.745 855.653,282.745 855.653,287.189z M855.653,279.41L850.264,279.41 850.264,266.077 855.653,266.077 855.653,279.41z" /> </Style> The trouble is that only the first item in the ListBox binds the Data property as expected, the other ones don't bind it at all (hence they appear as blank space, but match the size of the Path ). Also when I use the style anywhere else (i.e. outside the ListBox), only the first instance that occurs will bind. The weird thing is that if I define for example the Fill property in the Style instead of inline, it works just fine and doesn't exibit the same problems as the Path property.</p
Tags (comma-separated)
Save Edits
Cancel