Skip to content

Commit 4eff60b

Browse files
lilyremigiabrliron
authored andcommitted
Introduce reusable TextBlockCommonStyle for better consistency and change styling of the treeview elements.
Added a shared style (TextBlockCommonStyle) to simplify and standardize TextBlock properties across the UI. This reduces code duplication and ensures consistent alignment, wrapping, and trimming behavior. Updated existing TextBlock elements to use the new style where applicable.
1 parent a6737c5 commit 4eff60b

1 file changed

Lines changed: 30 additions & 17 deletions

File tree

thcrap_configure_v3/Page2_advanced.xaml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
</DataTrigger>
4141
</Style.Triggers>
4242
</Style>
43+
<Style x:Key="TextBlockCommonStyle" TargetType="TextBlock">
44+
<Setter Property="TextWrapping" Value="Wrap" />
45+
<Setter Property="VerticalAlignment" Value="Stretch" />
46+
<Setter Property="HorizontalAlignment" Value="Left" />
47+
<Setter Property="TextTrimming" Value="WordEllipsis" />
48+
</Style>
4349
</UserControl.Resources>
4450

4551

@@ -147,14 +153,30 @@
147153

148154
<TextBlock
149155
Grid.Column="0"
150-
Grid.ColumnSpan="2">
156+
Margin="0 0 3 0"
157+
Padding="0"
158+
Style="{StaticResource TextBlockCommonStyle}"
159+
Width="55"
160+
Height="18">
151161
<TextBlock.Text>
152-
<MultiBinding StringFormat="{}{0} ({1})">
153-
<Binding Path="SourcePatch.Title" />
154-
<Binding Path="SourcePatch.Id" />
155-
</MultiBinding>
162+
<Binding Path="SourcePatch.Id" />
156163
</TextBlock.Text>
157164
</TextBlock>
165+
<Border
166+
Grid.Column="1"
167+
Padding="0"
168+
Margin="0"
169+
BorderThickness="1,0,0,0"
170+
BorderBrush="LightGray">
171+
<TextBlock
172+
Margin="3 0 0 0"
173+
Style="{StaticResource TextBlockCommonStyle}"
174+
MaxHeight="18">
175+
<TextBlock.Text>
176+
<Binding Path="SourcePatch.Title" />
177+
</TextBlock.Text>
178+
</TextBlock>
179+
</Border>
158180
<!-- In a Grid later defined elements are on the top -->
159181
<Button
160182
Grid.Column="0"
@@ -238,12 +260,9 @@
238260
<TextBlock
239261
Padding="0"
240262
Margin="3,0,0,0"
241-
TextWrapping="Wrap"
242263
MaxWidth="270"
243264
MaxHeight="40"
244-
VerticalAlignment="Stretch"
245-
HorizontalAlignment="Left"
246-
TextTrimming="WordEllipsis">
265+
Style="{StaticResource TextBlockCommonStyle}">
247266
<TextBlock.Text>
248267
<Binding Path="SourcePatch.Title" />
249268
</TextBlock.Text>
@@ -256,11 +275,8 @@
256275
Grid.Row="0"
257276
Padding="0"
258277
Margin="2 0 3 0"
259-
VerticalAlignment="Stretch"
260-
HorizontalAlignment="Stretch"
261-
TextWrapping="NoWrap"
262-
TextTrimming="CharacterEllipsis"
263278
TextAlignment="Center"
279+
Style="{StaticResource TextBlockCommonStyle}"
264280
Width="55">
265281
<TextBlock.Text>
266282
<Binding Path="SourcePatch.Repo.Id" />
@@ -272,11 +288,8 @@
272288
Grid.Row="1"
273289
Padding="0"
274290
Margin="2 0 3 0"
275-
VerticalAlignment="Stretch"
276-
HorizontalAlignment="Stretch"
277-
TextWrapping="NoWrap"
278-
TextTrimming="CharacterEllipsis"
279291
TextAlignment="Center"
292+
Style="{StaticResource TextBlockCommonStyle}"
280293
Width="55">
281294
<TextBlock.Text>
282295
<Binding Path="SourcePatch.Id" />

0 commit comments

Comments
 (0)