Skip to content

Commit

Permalink
Merge pull request #1499 from unoplatform/dev/ks/material-filledTextb…
Browse files Browse the repository at this point in the history
…ox-layout
  • Loading branch information
Kunal22shah authored Oct 31, 2024
2 parents a81d814 + 0ec2d62 commit 2d0bb4d
Showing 1 changed file with 43 additions and 45 deletions.
88 changes: 43 additions & 45 deletions src/library/Uno.Material/Styles/Controls/v2/TextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,31 +540,48 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>

<!-- Padding and VerticalAlignement="Top" are here to make sure the ScrollViewer does not move when entering a second line when multiline is enabled -->
<ScrollViewer x:Name="ContentElement"
Grid.Column="1"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsTabStop="False"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
Padding="0,10"
VerticalAlignment="Top"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
ZoomMode="Disabled"
AutomationProperties.AccessibilityView="Raw">
<ScrollViewer.RenderTransform>
<CompositeTransform x:Name="ContentElement_CompositeTransform" />
</ScrollViewer.RenderTransform>
</ScrollViewer>

<!-- Border in place to properly vertically center the placeholder inside when it's a one-line TextBox -->
<!-- but keep it in the same place and at the top when it's a multiline TextBox -->
<Border Grid.Column="1"
VerticalAlignment="Center">
<Border Height="38">
<Grid Grid.Column="1">
<Border MinHeight="38"
VerticalAlignment="Top"
Padding="0,10,0,8">
<!-- Padding and VerticalAlignement="Top" are here to make sure the ScrollViewer does not move when entering a second line when multiline is enabled -->
<ScrollViewer x:Name="ContentElement"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsTabStop="False"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
VerticalAlignment="Top"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
ZoomMode="Disabled"
AutomationProperties.AccessibilityView="Raw">
<ScrollViewer.RenderTransform>
<CompositeTransform x:Name="ContentElement_CompositeTransform" />
</ScrollViewer.RenderTransform>
</ScrollViewer>
</Border>

<Border Height="38"
VerticalAlignment="Top">
<TextBlock x:Name="PlaceholderElement"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
RenderTransformOrigin="0,0.5"
Visibility="{Binding Text, Converter={StaticResource EmptyToVisibleConverter}, RelativeSource={RelativeSource TemplatedParent}}"
Text="{Binding PlaceholderText, RelativeSource={RelativeSource TemplatedParent}}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.RenderTransform>
<CompositeTransform x:Name="PlaceholderElement_CompositeTransform" />
</TextBlock.RenderTransform>
</TextBlock>
</Border>
<Border Height="38"
VerticalAlignment="Top">
<TextBlock x:Name="HeaderElement"
Foreground="{ThemeResource FilledTextBoxHeaderForeground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Expand All @@ -579,26 +596,7 @@
</TextBlock.RenderTransform>
</TextBlock>
</Border>
</Border>

<Border Grid.Column="1"
Height="38"
VerticalAlignment="Center">
<TextBlock x:Name="PlaceholderElement"
Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
RenderTransformOrigin="0,0.5"
Visibility="{Binding Text, Converter={StaticResource EmptyToVisibleConverter}, RelativeSource={RelativeSource TemplatedParent}}"
Text="{Binding PlaceholderText, RelativeSource={RelativeSource TemplatedParent}}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.RenderTransform>
<CompositeTransform x:Name="PlaceholderElement_CompositeTransform" />
</TextBlock.RenderTransform>
</TextBlock>
</Border>
</Grid>

<Button x:Name="DeleteButton"
Grid.Column="2"
Expand Down

0 comments on commit 2d0bb4d

Please sign in to comment.