Guest User

Untitled

a guest
Jan 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. public IEnumerable<LibraryViewModel> Libraries {
  2. get {
  3. if (!string.IsNullOrEmpty(this.LibrarySearchString))
  4. return _libraries.Where(lib => IsLibraryMatch(lib, this.LibrarySearchString));
  5. else
  6. return _libraries.OrderBy(lib => !lib.IsFavourite);
  7. }
  8. }
  9.  
  10. <con:FilterListBox Grid.Row="1"
  11. ItemsSource="{Binding Libraries}"
  12. SelectedItem="{Binding SelectedLibrary}"
  13. ItemTemplate="{StaticResource
  14. LibraryItemTemplate}"
  15. SearchString="{Binding LibrarySearchString, Mode=TwoWay}"
  16. IsSearching="False"
  17. Margin="4"/>
  18.  
  19. <Style x:Key="{x:Type con:FilterListBox}" TargetType="{x:Type con:FilterListBox}">
  20. <Setter Property="Template">
  21. <Setter.Value>
  22. <ControlTemplate TargetType="{x:Type con:FilterListBox}">
  23. <Grid>
  24. <Grid.RowDefinitions>
  25. <RowDefinition Height="Auto"/>
  26. <RowDefinition/>
  27. </Grid.RowDefinitions>
  28.  
  29. <DockPanel Grid.Row="0">
  30. <TextBlock Text="Search"
  31. VerticalAlignment="Center"/>
  32. <TextBox Text="{Binding RelativeSource={RelativeSource TemplatedParent},
  33. Path=SearchString,
  34. UpdateSourceTrigger=PropertyChanged}"
  35. Margin="4,0,0,0"/>
  36. </DockPanel>
  37.  
  38. <ScrollViewer Grid.Row="1" CanContentScroll="True">
  39. <StackPanel IsItemsHost="True"
  40. HorizontalAlignment="Stretch"/>
  41. </ScrollViewer>
  42.  
  43. <TextBlock Grid.Row="1"
  44. Text="Searching..."
  45. HorizontalAlignment="Center"
  46. VerticalAlignment="Center"
  47. Visibility="{Binding RelativeSource={RelativeSource TemplatedParent},
  48. Path=IsSearching,
  49. Converter={StaticResource CollapsedIfFalseConverter}}"/>
  50. </Grid>
  51.  
  52. </ControlTemplate>
  53. </Setter.Value>
  54. </Setter>
  55. </Style>
Add Comment
Please, Sign In to add comment