Skip to content

[WASM] TextBox Multiline is smaller than it should #3832

Closed

Description

@MaximeDion-Work

Current behavior

Multiline text on wasm is not behaving the same as on UWP.
image

Expected behavior

Multiline text should expend on wasm just like on UWP

How to reproduce it (as minimally and precisely as possible)

Style:

<Style x:Key="MaterialFilledTextBoxStyle"
		   TargetType="TextBox">

		<Setter Property="Foreground"
				Value="{StaticResource TextBoxLabelDefaultColorBrush}" />
		<Setter Property="PlaceholderForeground"
				Value="{StaticResource TextBoxLabelDefaultColorBrush}" />
		<Setter Property="Background"
				Value="{StaticResource TextBoxFilledBackgroundColorBrush}" />
		<Setter Property="BorderBrush"
				Value="{StaticResource TextBoxFilledIndicatorColorBrush}" />
		<Setter Property="HorizontalContentAlignment"
				Value="Left" />
		<Setter Property="VerticalContentAlignment"
				Value="Center" />

		<macos:Setter Property="Padding"
					  Value="12,4" />

		<not_macos:Setter Property="Padding"
						  Value="12,16" />

		<Setter Property="MinHeight"
				Value="50" />

		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="TextBox">
					<Grid x:Name="Root"
						  Background="{TemplateBinding Background}"
						  CornerRadius="{TemplateBinding CornerRadius}">

						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="PointerOver" />
								<VisualState x:Name="Pressed" />
								<VisualState x:Name="Disabled">
									<VisualState.Setters>
										<Setter Target="ContentElement.Opacity"
												Value="0.5" />
										<Setter Target="PlaceholderElement.Opacity"
												Value="0.5" />
									</VisualState.Setters>
								</VisualState>
								<VisualState x:Name="Focused">
									<VisualState.Setters>
										<Setter Target="PlaceholderElement.Foreground"
												Value="{StaticResource TextBoxLabelFocusColorBrush}" />
									</VisualState.Setters>
									<Storyboard>
										<DoubleAnimation Storyboard.TargetName="FocusedBorder_ScaleTransform"
														 Storyboard.TargetProperty="ScaleX"
														 Duration="0:0:0.2"
														 EasingFunction="{StaticResource Material_EaseInOutFunction}"
														 To="1" />
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="ButtonStates">
								<VisualState x:Name="ButtonVisible">
									<VisualState.Setters>
										<Setter Target="DeleteButton.Visibility"
												Value="Visible" />
									</VisualState.Setters>
								</VisualState>
								<VisualState x:Name="ButtonCollapsed" />
							</VisualStateGroup>
							<VisualStateGroup x:Name="HeaderStates">
								<VisualState x:Name="NotEmpty">
									<Storyboard>
										<DoubleAnimation Storyboard.TargetName="PlaceholderElement_CompositeTransform"
														 Storyboard.TargetProperty="TranslateY"
														 Duration="0:0:0.2"
														 EasingFunction="{StaticResource Material_EaseInOutFunction}"
														 To="-11" />
										<DoubleAnimation Storyboard.TargetName="ContentElement_CompositeTransform"
														 Storyboard.TargetProperty="TranslateY"
														 Duration="0:0:0.2"
														 EasingFunction="{StaticResource Material_EaseInOutFunction}"
														 To="5" />
										<DoubleAnimation Storyboard.TargetName="PlaceholderElement_CompositeTransform"
														 Storyboard.TargetProperty="ScaleX"
														 Duration="0:0:0.2"
														 EasingFunction="{StaticResource Material_EaseInOutFunction}"
														 To="0.7" />
										<DoubleAnimation Storyboard.TargetName="PlaceholderElement_CompositeTransform"
														 Storyboard.TargetProperty="ScaleY"
														 Duration="0:0:0.2"
														 EasingFunction="{StaticResource Material_EaseInOutFunction}"
														 To="0.7" />
									</Storyboard>
									<VisualState.StateTriggers>
										<StateTrigger IsActive="{Binding Text, Converter={StaticResource Material_EmptyToFalse}, RelativeSource={RelativeSource TemplatedParent}}" />
									</VisualState.StateTriggers>
								</VisualState>
								<VisualState x:Name="Empty">
									<VisualState.StateTriggers>
										<StateTrigger IsActive="{Binding Text, Converter={StaticResource Material_EmptyToTrue}, RelativeSource={RelativeSource TemplatedParent}}" />
									</VisualState.StateTriggers>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>

						<Grid Margin="{TemplateBinding Padding}">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="Auto" />
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>

							<ContentPresenter x:Name="IconPresenter"
											  Content="{Binding Path=(extensions:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}}"
											  HorizontalAlignment="Center"
											  Margin="0,0,8,0"
											  MaxHeight="34"
											  MaxWidth="34"
											  MinWidth="25"
											  not_macos:VerticalAlignment="Top"
											  macos:VerticalAlignment="Center"
											  Visibility="{Binding Path=(extensions:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Material_NullToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}" />

							
							<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}"
										  macos:VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
										  not_macos:VerticalAlignment="Bottom"
										  VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
										  VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
										  ZoomMode="Disabled"
										  AutomationProperties.AccessibilityView="Raw">
								<ScrollViewer.RenderTransform>
									<CompositeTransform x:Name="ContentElement_CompositeTransform" />
								</ScrollViewer.RenderTransform>
							</ScrollViewer>

							<TextBlock x:Name="PlaceholderElement"
									   Grid.Column="1"
									   Foreground="{Binding PlaceholderForeground, RelativeSource={RelativeSource TemplatedParent}}"
									   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
									   IsHitTestVisible="False"
									   RenderTransformOrigin="0,0.5"
									   Text="{TemplateBinding PlaceholderText}"
									   TextAlignment="{TemplateBinding TextAlignment}"
									   TextWrapping="{TemplateBinding TextWrapping}"
									   not_macos:VerticalAlignment="Top"
									   macos:VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
								<TextBlock.RenderTransform>
									<CompositeTransform x:Name="PlaceholderElement_CompositeTransform" />
								</TextBlock.RenderTransform>
							</TextBlock>

							<Button x:Name="DeleteButton"
									Grid.Column="2"
									Foreground="{TemplateBinding BorderBrush}"
									IsTabStop="False"
									Style="{StaticResource DeleteButtonStyle}"
									not_macos:VerticalAlignment="Bottom"
									macos:VerticalAlignment="Stretch"
									Visibility="Collapsed"
									AutomationProperties.AccessibilityView="Raw" />
						</Grid>

						<Rectangle x:Name="NormalBorder"
								   Fill="{StaticResource TextBoxOutlinedStrokeColorBrush}"
								   Height="{StaticResource TextBoxOutlinedStrokeWidth}"
								   VerticalAlignment="Bottom" />

						<Rectangle x:Name="FocusedBorder"
									Fill="{StaticResource TextBoxOutlinedFocusStrokeColorBrush}"
									Height="{StaticResource TextBoxFocusStrokeWidth}"
									VerticalAlignment="Bottom"
									not_macos:RenderTransformOrigin="0.5,0.5"
									macos:RenderTransformOrigin="0.0,0.5">
							<Rectangle.RenderTransform>
								<ScaleTransform x:Name="FocusedBorder_ScaleTransform"
												ScaleX="0" />
							</Rectangle.RenderTransform>
						</Rectangle>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

Implementation:

			<!-- TextBox MultiLine -->
			<smtx:XamlDisplay UniqueKey="TextBoxSamplePage_6"
							  Style="{StaticResource XamlDisplayBelowStyle}">
				<TextBox Text="Lorem ipsum dolor sit amet consectetur adipiscing, elit aliquam ullamcorper commodo primis ornare himenaeos, inceptos tellus accumsan praesent laoreet. Pharetra semper ullamcorper neque mollis vestibulum luctus gravida facilisi rhoncus, rutrum massa bibendum vitae imperdiet quisque fames dignissim, varius curae erat risus platea orci quis scelerisque. Auctor erat vestibulum enim sodales sapien nam litora rhoncus condimentum praesent, platea dui odio eros integer id gravida turpis semper nisi maecenas, nascetur dictumst sed arcu aenean varius dis leo habitant."
						 PlaceholderText="MultiLine Filled"
						 Style="{StaticResource MaterialFilledTextBoxStyle}"
						 TextWrapping="Wrap"
						 AcceptsReturn="True" />
			</smtx:XamlDisplay>

Environment

Nuget Package: Uno.UI 3.0.0-dev.1533

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Windows
  • Build tasks
  • Solution Templates

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Project: Uno.Material(Uno.Gallery)
Notes:
Tried setting on VerticalScrollMode and VerticalScrollBarVisibility to Disabled on ContentElement.
Tried changing the ScrollViewer to a content presenter.

Activity

  1. added
    kind/bug
    triage/untriaged
    on Aug 17, 2020
  2. added this to the 3.1 milestone on Aug 28, 2020
  3. removed
    triage/untriaged
    on Aug 28, 2020
  4. removed this from the 3.1 milestone on Aug 31, 2020
  5. self-assigned this
    on Sep 1, 2020
  6. added
    project/text 🔤
    on Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugproject/text 🔤

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions