Commit 3d51643
committed
Auto-size NavigationView pane to fit the widest sidebar label
The previously hardcoded OpenPaneLength="185" clipped English labels
like "Software information", "Donate to the author", and "Backup and
restore", as well as longer translations such as de-DE
"Programmeinstellungen" / "Backup-Wiederherstellung", pt-BR
"Configurações do Programa", tr-TR "Yedekleme ve Geri Yükleme", and
ru-RU "Поблагодарить автора".
Computes the required pane length at startup from the actual labels:
the natural width of each item's text (via FormattedText at the
NavigationView's typeface/size/DPI) plus role-specific chrome
measured against iNKORE.UI.WPF.Modern v0.10.2's NavigationViewItem
template — 100px for expandable parents (icon + chevron slot), 74px
for icon-only footer leaves, 67px for nested leaves. Result is
clamped to [185, 400] so section items with short text don't shrink
the pane below the original width and no single pathological label
eats the content area. Since language changes trigger
SingleInstance.Restart(), the calculation runs exactly once per
launch.1 parent 0bdb13a commit 3d51643
2 files changed
Lines changed: 46 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
152 | 198 | | |
153 | 199 | | |
154 | 200 | | |
| |||
0 commit comments