|
12 | 12 | using Microsoft.UI.Xaml.Input;
|
13 | 13 | using Microsoft.UI.Xaml.Media;
|
14 | 14 | using Microsoft.UI.Xaml.Navigation;
|
| 15 | +using Vanara.Extensions.Reflection; |
15 | 16 | using Windows.Storage;
|
16 | 17 | using Windows.System;
|
17 | 18 | using Windows.UI.Core;
|
@@ -191,17 +192,30 @@ override public void StartRenameItem()
|
191 | 192 | }
|
192 | 193 | else
|
193 | 194 | {
|
194 |
| - TextBlock textBlock = gridViewItem.FindDescendant("ItemName") as TextBlock; |
| 195 | + TextBlock textBlockName = gridViewItem.FindDescendant("ItemName") as TextBlock; |
| 196 | + TextBlock textBlockFormat = gridViewItem.FindDescendant("ItemFileFormat") as TextBlock; |
| 197 | + TextBlock textBlockSize = gridViewItem.FindDescendant("ItemSize") as TextBlock; |
195 | 198 | textBox = gridViewItem.FindDescendant("TileViewTextBoxItemName") as TextBox;
|
196 |
| - textBox.Text = textBlock.Text; |
197 |
| - OldItemName = textBlock.Text; |
198 |
| - textBlock.Visibility = Visibility.Collapsed; |
| 199 | + Grid gridMain = gridViewItem.FindDescendant("MainGrid") as Grid; |
| 200 | + |
| 201 | + textBox.Text = textBlockName.Text; |
| 202 | + OldItemName = textBlockName.Text; |
| 203 | + |
| 204 | + textBlockName.Visibility = Visibility.Collapsed; |
| 205 | + textBlockFormat.Visibility = Visibility.Collapsed; |
| 206 | + textBlockSize.Visibility = Visibility.Collapsed; |
199 | 207 | textBox.Visibility = Visibility.Visible;
|
| 208 | + gridMain.ColumnDefinitions[0].Width = new GridLength(0); |
| 209 | + gridMain.ColumnDefinitions[1].Width = new GridLength(0); |
200 | 210 |
|
201 | 211 | if (textBox.FindParent<Grid>() is null)
|
202 | 212 | {
|
203 |
| - textBlock.Visibility = Visibility.Visible; |
| 213 | + textBlockName.Visibility = Visibility.Visible; |
| 214 | + textBlockFormat.Visibility = Visibility.Visible; |
| 215 | + textBlockSize.Visibility = Visibility.Visible; |
204 | 216 | textBox.Visibility = Visibility.Collapsed;
|
| 217 | + gridMain.ColumnDefinitions[0].Width = GridLength.Auto; |
| 218 | + gridMain.ColumnDefinitions[1].Width = new GridLength(64); |
205 | 219 | return;
|
206 | 220 | }
|
207 | 221 | }
|
@@ -247,9 +261,17 @@ protected override void EndRename(TextBox textBox)
|
247 | 261 | }
|
248 | 262 | else if (FolderSettings.LayoutMode == FolderLayoutModes.TilesView)
|
249 | 263 | {
|
250 |
| - TextBlock? textBlock = gridViewItem.FindDescendant("ItemName") as TextBlock; |
| 264 | + TextBlock? textBlockName = gridViewItem.FindDescendant("ItemName") as TextBlock; |
| 265 | + TextBlock? textBlockFormat = gridViewItem.FindDescendant("ItemFileFormat") as TextBlock; |
| 266 | + TextBlock? textBlockSize = gridViewItem.FindDescendant("ItemSize") as TextBlock; |
| 267 | + Grid? gridMain = gridViewItem.FindDescendant("MainGrid") as Grid; |
| 268 | + |
251 | 269 | textBox.Visibility = Visibility.Collapsed;
|
252 |
| - textBlock!.Visibility = Visibility.Visible; |
| 270 | + textBlockName!.Visibility = Visibility.Visible; |
| 271 | + textBlockFormat!.Visibility = Visibility.Visible; |
| 272 | + textBlockSize!.Visibility = Visibility.Visible; |
| 273 | + gridMain.ColumnDefinitions[0].Width = GridLength.Auto; |
| 274 | + gridMain.ColumnDefinitions[1].Width = new GridLength(64); |
253 | 275 | }
|
254 | 276 |
|
255 | 277 | textBox!.LostFocus -= RenameTextBox_LostFocus;
|
|
0 commit comments