|
25 | 25 | SelectionChanged="OnSelectionChanged" |
26 | 26 | SelectionMode="Single" |
27 | 27 | Style="{DynamicResource BaseListboxStyle}" |
| 28 | + ScrollViewer.CanContentScroll="True" |
28 | 29 | VirtualizingStackPanel.IsVirtualizing="True" |
29 | | - VirtualizingStackPanel.VirtualizationMode="Standard" |
| 30 | + VirtualizingStackPanel.VirtualizationMode="Recycling" |
| 31 | + VirtualizingPanel.ScrollUnit="Pixel" |
| 32 | + VirtualizingPanel.CacheLength="1,1" |
| 33 | + VirtualizingPanel.CacheLengthUnit="Page" |
30 | 34 | Visibility="{Binding Visibility}" |
31 | 35 | mc:Ignorable="d"> |
32 | 36 | <!-- IsSynchronizedWithCurrentItem: http://stackoverflow.com/a/7833798/2833083 --> |
33 | 37 |
|
34 | 38 | <ListBox.ItemTemplate> |
35 | 39 | <DataTemplate> |
36 | | - <Button HorizontalAlignment="Stretch"> |
37 | | - <Button.Template> |
38 | | - <ControlTemplate> |
39 | | - <ContentPresenter Content="{TemplateBinding Button.Content}" /> |
40 | | - </ControlTemplate> |
41 | | - </Button.Template> |
42 | | - <Button.Content> |
43 | | - <Grid |
44 | | - Margin="0" |
45 | | - HorizontalAlignment="Stretch" |
46 | | - VerticalAlignment="Stretch" |
47 | | - UseLayoutRounding="False"> |
48 | | - <Grid.Resources> |
49 | | - <converter:HighlightTextConverter x:Key="HighlightTextConverter" /> |
50 | | - </Grid.Resources> |
51 | | - <Grid.ColumnDefinitions> |
52 | | - <ColumnDefinition Style="{DynamicResource ImageAreaWidth}" /> |
53 | | - <ColumnDefinition Width="9*" /> |
54 | | - </Grid.ColumnDefinitions> |
55 | | - |
56 | | - <StackPanel |
57 | | - Grid.Column="0" |
58 | | - Margin="9 0 0 0" |
59 | | - VerticalAlignment="Center"> |
60 | | - <Image |
61 | | - x:Name="ImageIcon" |
62 | | - IsHitTestVisible="False" |
63 | | - RenderOptions.BitmapScalingMode="Linear" |
64 | | - Source="{Binding Image, TargetNullValue={x:Null}}" |
65 | | - Stretch="Uniform" |
66 | | - StretchDirection="DownOnly" |
67 | | - Style="{DynamicResource ImageIconStyle}" |
68 | | - Visibility="{Binding ShowIcon}"> |
69 | | - </Image> |
70 | | - |
71 | | - <TextBlock |
72 | | - x:Name="GlyphIcon" |
73 | | - FontFamily="{Binding Glyph.FontFamily}" |
74 | | - Style="{DynamicResource ItemGlyph}" |
75 | | - Text="{Binding Glyph.Glyph}" |
76 | | - Visibility="{Binding ShowGlyph}" /> |
77 | | - </StackPanel> |
| 40 | + <DockPanel |
| 41 | + Margin="0" |
| 42 | + HorizontalAlignment="Stretch" |
| 43 | + VerticalAlignment="Stretch" |
| 44 | + UseLayoutRounding="False"> |
| 45 | + <DockPanel.Resources> |
| 46 | + <converter:HighlightTextConverter x:Key="HighlightTextConverter" /> |
| 47 | + </DockPanel.Resources> |
78 | 48 |
|
79 | | - <StackPanel |
80 | | - Grid.Column="1" |
81 | | - Margin="6 0 10 0" |
82 | | - HorizontalAlignment="Stretch" |
83 | | - VerticalAlignment="Center"> |
84 | | - <TextBlock |
85 | | - x:Name="Title" |
86 | | - DockPanel.Dock="Left" |
87 | | - FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
88 | | - IsEnabled="False" |
89 | | - Style="{DynamicResource ItemTitleStyle}" |
90 | | - Text="{Binding Result.Title}" |
91 | | - TextTrimming="CharacterEllipsis" |
92 | | - ToolTip="{Binding ShowTitleToolTip}" |
93 | | - ToolTipService.ShowOnDisabled="True"> |
94 | | - <vm:ResultsViewModel.FormattedText> |
95 | | - <MultiBinding Converter="{StaticResource HighlightTextConverter}"> |
96 | | - <Binding Path="Result.Title" /> |
97 | | - <Binding Path="Result.TitleHighlightData" /> |
98 | | - </MultiBinding> |
99 | | - </vm:ResultsViewModel.FormattedText> |
100 | | - </TextBlock> |
101 | | - <TextBlock |
102 | | - x:Name="SubTitle" |
103 | | - FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
104 | | - IsEnabled="False" |
105 | | - Style="{DynamicResource ItemSubTitleStyle}" |
106 | | - Text="{Binding Result.SubTitle}" |
107 | | - TextTrimming="CharacterEllipsis" |
108 | | - ToolTip="{Binding ShowSubTitleToolTip}" |
109 | | - ToolTipService.ShowOnDisabled="True" /> |
110 | | - </StackPanel> |
| 49 | + <Image |
| 50 | + DockPanel.Dock="Left" |
| 51 | + Margin="5 0 0 0" |
| 52 | + Width="60" |
| 53 | + VerticalAlignment="Center" |
| 54 | + x:Name="ImageIcon" |
| 55 | + IsHitTestVisible="False" |
| 56 | + RenderOptions.BitmapScalingMode="Linear" |
| 57 | + Source="{Binding Image, TargetNullValue={x:Null}}" |
| 58 | + Stretch="Uniform" |
| 59 | + StretchDirection="DownOnly" |
| 60 | + Style="{DynamicResource ImageIconStyle}" |
| 61 | + Visibility="{Binding ShowIcon}"/> |
| 62 | + <TextBlock |
| 63 | + DockPanel.Dock="Left" |
| 64 | + Margin="5 0 0 0" |
| 65 | + Width="60" |
| 66 | + VerticalAlignment="Center" |
| 67 | + x:Name="GlyphIcon" |
| 68 | + FontFamily="{Binding Glyph.FontFamily}" |
| 69 | + Style="{DynamicResource ItemGlyph}" |
| 70 | + Text="{Binding Glyph.Glyph}" |
| 71 | + TextAlignment="Center" |
| 72 | + Visibility="{Binding ShowGlyph}" /> |
111 | 73 |
|
112 | | - </Grid> |
113 | | - </Button.Content> |
114 | | - </Button> |
| 74 | + <StackPanel |
| 75 | + Margin="6 0 10 0" |
| 76 | + HorizontalAlignment="Stretch" |
| 77 | + VerticalAlignment="Center"> |
| 78 | + <TextBlock |
| 79 | + x:Name="Title" |
| 80 | + DockPanel.Dock="Left" |
| 81 | + FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
| 82 | + IsEnabled="False" |
| 83 | + Style="{DynamicResource ItemTitleStyle}" |
| 84 | + Text="{Binding Result.Title}" |
| 85 | + TextTrimming="CharacterEllipsis" |
| 86 | + ToolTip="{Binding ShowTitleToolTip}" |
| 87 | + ToolTipService.ShowOnDisabled="True"> |
| 88 | + <vm:ResultsViewModel.FormattedText> |
| 89 | + <MultiBinding Converter="{StaticResource HighlightTextConverter}"> |
| 90 | + <Binding Path="Result.Title" /> |
| 91 | + <Binding Path="Result.TitleHighlightData" /> |
| 92 | + </MultiBinding> |
| 93 | + </vm:ResultsViewModel.FormattedText> |
| 94 | + </TextBlock> |
| 95 | + <TextBlock |
| 96 | + x:Name="SubTitle" |
| 97 | + FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
| 98 | + IsEnabled="False" |
| 99 | + Style="{DynamicResource ItemSubTitleStyle}" |
| 100 | + Text="{Binding Result.SubTitle}" |
| 101 | + TextTrimming="CharacterEllipsis" |
| 102 | + ToolTip="{Binding ShowSubTitleToolTip}" |
| 103 | + ToolTipService.ShowOnDisabled="True" /> |
| 104 | + </StackPanel> |
| 105 | + </DockPanel> |
115 | 106 | <!-- a result item height is 52 including margin --> |
116 | 107 | <DataTemplate.Triggers> |
117 | 108 | <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True"> |
|
0 commit comments