|
24 | 24 | </Window.KeyBindings> |
25 | 25 | <Window.Resources> |
26 | 26 | <local:BitmapAssetValueConverter x:Key="VariableImage" /> |
| 27 | + <Styles x:Key="CustomVirtualizingStackPanelStyle"> |
| 28 | + <Style Selector="VirtualizingStackPanel"> |
| 29 | + <Setter Property="Margin" Value="0 0 0 100" /> |
| 30 | + </Style> |
| 31 | + </Styles> |
27 | 32 | </Window.Resources> |
28 | 33 | <Design.DataContext> |
29 | 34 | <!-- This only sets the DataContext for the previewer in an IDE, |
|
84 | 89 | Source="{Binding CurrentSelectedImage.ImagePath, Converter={StaticResource VariableImage}, ConverterParameter=500}" /> |
85 | 90 | </Border> |
86 | 91 | <Grid Grid.Row="2" ColumnDefinitions="8*, Auto" RowDefinitions="*"> |
87 | | - <ListBox Grid.Column="0" Items="{Binding CurrentSelectedImage.Tags}" |
88 | | - SelectedItem="{Binding CurrentSelectedTag}" |
89 | | - SelectionMode="Single" |
90 | | - SelectedIndex="0" |
91 | | - SelectionChanged="TagListBox_OnSelectionChanged"> |
92 | | - <ListBox.KeyBindings> |
93 | | - <KeyBinding Gesture="Down" Command="{Binding SelectNextTagCommand}" /> |
94 | | - <KeyBinding Gesture="Up" Command="{Binding SelectPreviousTagCommand}" /> |
95 | | - <KeyBinding Gesture="Enter" |
96 | | - Command="{Binding DataContext.SetSuggestionCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
97 | | - <KeyBinding Gesture="Escape" |
98 | | - Command="{Binding DataContext.CloseSuggestionsCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
99 | | - <KeyBinding Gesture="Alt+Down" |
100 | | - Command="{Binding DataContext.MoveTagDownCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
101 | | - <KeyBinding Gesture="Alt+Up" |
102 | | - Command="{Binding DataContext.MoveTagUpCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
103 | | - </ListBox.KeyBindings> |
104 | | - <ListBox.ItemTemplate> |
105 | | - <DataTemplate> |
106 | | - <Grid RowDefinitions="Auto, Auto" ColumnDefinitions="Auto, *"> |
107 | | - <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" |
108 | | - Margin="0 0 5 0"> |
109 | | - <Button Height="25" Width="25" Click="TagMoveUp_OnClick"> |
110 | | - <Image Height="20" Width="20" HorizontalAlignment="Stretch" |
111 | | - VerticalAlignment="Stretch" |
112 | | - Source="{SvgImage /Assets/arrow-up.svg}" /> |
113 | | - </Button> |
114 | | - <Button Height="25" Width="25" Click="TagMoveDown_OnClick"> |
115 | | - <Image Height="20" Width="20" HorizontalAlignment="Stretch" |
116 | | - VerticalAlignment="Stretch" |
117 | | - Source="{SvgImage /Assets/arrow-down.svg}" /> |
118 | | - </Button> |
119 | | - </StackPanel> |
120 | | - <TextBox Grid.Row="0" Grid.Column="1" GotFocus="Tag_OnGotFocus" |
121 | | - LostFocus="Tag_OnLostFocus" |
122 | | - Text="{Binding Value}" |
123 | | - HorizontalContentAlignment="Left" /> |
124 | | - <ListBox Grid.Row="1" Grid.Column="1" Name="SuggestionListBox" |
125 | | - Items="{Binding DataContext.TagSuggestions, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" |
126 | | - SelectedItem="{Binding DataContext.CurrentSelectedSuggestion, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" |
127 | | - SelectionMode="Single" |
128 | | - IsVisible="{Binding ShowAutocomplete}"> |
129 | | - <ListBox.ItemTemplate> |
130 | | - <DataTemplate> |
131 | | - <TextBlock Text="{Binding}" Tapped="Suggestion_OnTapped" |
132 | | - PointerPressed="Suggestion_OnPointerPressed" /> |
133 | | - </DataTemplate> |
134 | | - </ListBox.ItemTemplate> |
135 | | - </ListBox> |
136 | | - </Grid> |
137 | | - </DataTemplate> |
138 | | - </ListBox.ItemTemplate> |
139 | | - </ListBox> |
| 92 | + <ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto" Name="ScrollViewer"> |
| 93 | + <ListBox Items="{Binding CurrentSelectedImage.Tags}" |
| 94 | + SelectedItem="{Binding CurrentSelectedTag}" |
| 95 | + SelectionMode="Single" |
| 96 | + SelectedIndex="0" |
| 97 | + SelectionChanged="TagListBox_OnSelectionChanged"> |
| 98 | + <ListBox.KeyBindings> |
| 99 | + <KeyBinding Gesture="Down" Command="{Binding SelectNextTagCommand}" /> |
| 100 | + <KeyBinding Gesture="Up" Command="{Binding SelectPreviousTagCommand}" /> |
| 101 | + <KeyBinding Gesture="Enter" |
| 102 | + Command="{Binding DataContext.SetSuggestionCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
| 103 | + <KeyBinding Gesture="Escape" |
| 104 | + Command="{Binding DataContext.CloseSuggestionsCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
| 105 | + <KeyBinding Gesture="Alt+Down" |
| 106 | + Command="{Binding DataContext.MoveTagDownCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
| 107 | + <KeyBinding Gesture="Alt+Up" |
| 108 | + Command="{Binding DataContext.MoveTagUpCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" /> |
| 109 | + </ListBox.KeyBindings> |
| 110 | + <ListBox.ItemsPanel> |
| 111 | + <ItemsPanelTemplate> |
| 112 | + <VirtualizingStackPanel |
| 113 | + Styles="{StaticResource CustomVirtualizingStackPanelStyle}" /> |
| 114 | + </ItemsPanelTemplate> |
| 115 | + </ListBox.ItemsPanel> |
| 116 | + <ListBox.ItemTemplate> |
| 117 | + <DataTemplate> |
| 118 | + <Grid RowDefinitions="Auto, Auto" ColumnDefinitions="Auto, *"> |
| 119 | + <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" |
| 120 | + Margin="0 0 5 0"> |
| 121 | + <Button Height="25" Width="25" Click="TagMoveUp_OnClick"> |
| 122 | + <Image Height="20" Width="20" HorizontalAlignment="Stretch" |
| 123 | + VerticalAlignment="Stretch" |
| 124 | + Source="{SvgImage /Assets/arrow-up.svg}" /> |
| 125 | + </Button> |
| 126 | + <Button Height="25" Width="25" Click="TagMoveDown_OnClick"> |
| 127 | + <Image Height="20" Width="20" HorizontalAlignment="Stretch" |
| 128 | + VerticalAlignment="Stretch" |
| 129 | + Source="{SvgImage /Assets/arrow-down.svg}" /> |
| 130 | + </Button> |
| 131 | + </StackPanel> |
| 132 | + <TextBox Grid.Row="0" Grid.Column="1" GotFocus="Tag_OnGotFocus" |
| 133 | + LostFocus="Tag_OnLostFocus" |
| 134 | + Text="{Binding Value}" |
| 135 | + HorizontalContentAlignment="Left" /> |
| 136 | + <ListBox Grid.Row="1" Grid.Column="1" Name="SuggestionListBox" |
| 137 | + Items="{Binding DataContext.TagSuggestions, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" |
| 138 | + SelectedItem="{Binding DataContext.CurrentSelectedSuggestion, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" |
| 139 | + SelectionMode="Single" |
| 140 | + IsVisible="{Binding ShowAutocomplete}"> |
| 141 | + <ListBox.ItemTemplate> |
| 142 | + <DataTemplate> |
| 143 | + <TextBlock Text="{Binding}" Tapped="Suggestion_OnTapped" |
| 144 | + PointerPressed="Suggestion_OnPointerPressed" /> |
| 145 | + </DataTemplate> |
| 146 | + </ListBox.ItemTemplate> |
| 147 | + </ListBox> |
| 148 | + </Grid> |
| 149 | + </DataTemplate> |
| 150 | + </ListBox.ItemTemplate> |
| 151 | + </ListBox> |
| 152 | + </ScrollViewer> |
140 | 153 |
|
141 | 154 | <StackPanel Grid.Column="1" Orientation="Vertical"> |
142 | 155 | <Button Height="50" Width="50" Command="{Binding AddTagCommand}"> |
|
0 commit comments