Add PlaceholderForeground property to TextBox, AutoCompleteBox, CalendarDatePicker, NumericUpDown (#20303)
* Added WatermarkForeground property * Added samples * Added unit tests * Added render tests * Fix merge issues * Updated render tests * Standardize watermark foreground naming * Pending changes * More changes * Use UseFloatingPlaceholder * Fix tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
|
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
|
||||||
x:Class="BindingDemo.MainWindow"
|
x:Class="BindingDemo.MainWindow"
|
||||||
xmlns:vm="using:BindingDemo.ViewModels"
|
xmlns:vm="using:BindingDemo.ViewModels"
|
||||||
xmlns:local="using:BindingDemo"
|
xmlns:local="using:BindingDemo"
|
||||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||||
Title="AvaloniaUI Bindings Test"
|
Title="AvaloniaUI Bindings Test"
|
||||||
@@ -13,29 +13,29 @@
|
|||||||
<Setter Property="FontSize" Value="18"/>
|
<Setter Property="FontSize" Value="18"/>
|
||||||
</Style>
|
</Style>
|
||||||
</Window.Styles>
|
</Window.Styles>
|
||||||
|
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="Basic">
|
<TabItem Header="Basic">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<StackPanel Margin="18" Spacing="4" Width="200">
|
<StackPanel Margin="18" Spacing="4" Width="200">
|
||||||
<TextBlock FontSize="16" Text="Simple Bindings"/>
|
<TextBlock FontSize="16" Text="Simple Bindings"/>
|
||||||
<TextBox Watermark="Two Way" UseFloatingWatermark="True" Text="{Binding Path=StringValue}" Name="first"/>
|
<TextBox PlaceholderText="Two Way" UseFloatingPlaceholder="True" Text="{Binding Path=StringValue}" Name="first"/>
|
||||||
<TextBox Watermark="Two Way (LostFocus)" UseFloatingWatermark="True" Text="{Binding Path=StringValue, UpdateSourceTrigger=LostFocus}"/>
|
<TextBox PlaceholderText="Two Way (LostFocus)" UseFloatingPlaceholder="True" Text="{Binding Path=StringValue, UpdateSourceTrigger=LostFocus}"/>
|
||||||
<TextBox Watermark="One Way" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneWay}"/>
|
<TextBox PlaceholderText="One Way" UseFloatingPlaceholder="True" Text="{Binding Path=StringValue, Mode=OneWay}"/>
|
||||||
<TextBox Watermark="One Time" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneTime}"/>
|
<TextBox PlaceholderText="One Time" UseFloatingPlaceholder="True" Text="{Binding Path=StringValue, Mode=OneTime}"/>
|
||||||
<!-- Removed due to #2983: reinstate when that's fixed.
|
<!-- Removed due to #2983: reinstate when that's fixed.
|
||||||
<TextBox Watermark="One Way to Source" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneWayToSource}"/>
|
<TextBox Placeholder="One Way to Source" UseFloatingPlaceholder="True" Text="{Binding Path=StringValue, Mode=OneWayToSource}"/>
|
||||||
-->
|
-->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="18" Spacing="4" Width="200">
|
<StackPanel Margin="18" Spacing="4" Width="200">
|
||||||
<TextBlock FontSize="16" Text="Collection Bindings"/>
|
<TextBlock FontSize="16" Text="Collection Bindings"/>
|
||||||
<TextBox Watermark="Items[1].Value" UseFloatingWatermark="True" Text="{Binding Path=Items[1].Value}"/>
|
<TextBox PlaceholderText="Items[1].Value" UseFloatingPlaceholder="True" Text="{Binding Path=Items[1].Value}"/>
|
||||||
<Button Command="{Binding ShuffleItems}">Shuffle</Button>
|
<Button Command="{Binding ShuffleItems}">Shuffle</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="18" Spacing="4" Width="200">
|
<StackPanel Margin="18" Spacing="4" Width="200">
|
||||||
<TextBlock FontSize="16" Text="Negated Bindings"/>
|
<TextBlock FontSize="16" Text="Negated Bindings"/>
|
||||||
<TextBox Watermark="Boolean String" UseFloatingWatermark="True" Text="{Binding Path=BooleanString}"/>
|
<TextBox PlaceholderText="Boolean String" UseFloatingPlaceholder="True" Text="{Binding Path=BooleanString}"/>
|
||||||
<CheckBox IsChecked="{Binding !BooleanString}">!BooleanString</CheckBox>
|
<CheckBox IsChecked="{Binding !BooleanString}">!BooleanString</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding !!BooleanString}">!!BooleanString</CheckBox>
|
<CheckBox IsChecked="{Binding !!BooleanString}">!!BooleanString</CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -43,24 +43,24 @@
|
|||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<StackPanel Margin="18" Spacing="4" Width="200" HorizontalAlignment="Left">
|
<StackPanel Margin="18" Spacing="4" Width="200" HorizontalAlignment="Left">
|
||||||
<TextBlock FontSize="16" Text="Numeric Bindings"/>
|
<TextBlock FontSize="16" Text="Numeric Bindings"/>
|
||||||
<TextBox Watermark="Double" UseFloatingWatermark="True" Text="{Binding Path=DoubleValue, Mode=TwoWay}"/>
|
<TextBox PlaceholderText="Double" UseFloatingPlaceholder="True" Text="{Binding Path=DoubleValue, Mode=TwoWay}"/>
|
||||||
<TextBlock Text="{Binding Path=DoubleValue}"/>
|
<TextBlock Text="{Binding Path=DoubleValue}"/>
|
||||||
<ProgressBar Maximum="10" Value="{Binding DoubleValue}"/>
|
<ProgressBar Maximum="10" Value="{Binding DoubleValue}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="18" Spacing="4" Width="200" HorizontalAlignment="Left">
|
<StackPanel Margin="18" Spacing="4" Width="200" HorizontalAlignment="Left">
|
||||||
<TextBlock FontSize="16" Text="Binding Sources"/>
|
<TextBlock FontSize="16" Text="Binding Sources"/>
|
||||||
<TextBox Watermark="Value of first TextBox" UseFloatingWatermark="True"
|
<TextBox PlaceholderText="Value of first TextBox" UseFloatingPlaceholder="True"
|
||||||
Text="{Binding #first.Text, Mode=TwoWay}"/>
|
Text="{Binding #first.Text, Mode=TwoWay}"/>
|
||||||
<TextBox Watermark="Value of SharedItem.StringValue" UseFloatingWatermark="True"
|
<TextBox PlaceholderText="Value of SharedItem.StringValue" UseFloatingPlaceholder="True"
|
||||||
Text="{Binding Value, Source={StaticResource SharedItem}, Mode=TwoWay, DataType={x:Type vm:MainWindowViewModel+TestItem, x:TypeArguments=x:String}}"/>
|
Text="{Binding Value, Source={StaticResource SharedItem}, Mode=TwoWay, DataType={x:Type vm:MainWindowViewModel+TestItem, x:TypeArguments=x:String}}"/>
|
||||||
<TextBox Watermark="Value of SharedItem.StringValue (duplicate)" UseFloatingWatermark="True"
|
<TextBox PlaceholderText="Value of SharedItem.StringValue (duplicate)" UseFloatingPlaceholder="True"
|
||||||
Text="{Binding Value, Source={StaticResource SharedItem}, Mode=TwoWay, DataType={x:Type vm:MainWindowViewModel+TestItem, x:TypeArguments=x:String}}"/>
|
Text="{Binding Value, Source={StaticResource SharedItem}, Mode=TwoWay, DataType={x:Type vm:MainWindowViewModel+TestItem, x:TypeArguments=x:String}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="18" Spacing="4" Width="200" HorizontalAlignment="Left">
|
<StackPanel Margin="18" Spacing="4" Width="200" HorizontalAlignment="Left">
|
||||||
<TextBlock FontSize="16" Text="Scheduler"/>
|
<TextBlock FontSize="16" Text="Scheduler"/>
|
||||||
<TextBox Watermark="Background Thread" Text="{Binding CurrentTime, Mode=OneWay}"/>
|
<TextBox PlaceholderText="Background Thread" Text="{Binding CurrentTime, Mode=OneWay}"/>
|
||||||
<TextBlock FontSize="16" Text="Stream Operator"/>
|
<TextBlock FontSize="16" Text="Stream Operator"/>
|
||||||
<TextBox Watermark="StreamOperator" Text="{CompiledBinding CurrentTimeObservable^, Mode=OneWay}"/>
|
<TextBox PlaceholderText="StreamOperator" Text="{CompiledBinding CurrentTimeObservable^, Mode=OneWay}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -91,19 +91,19 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Property Validation">
|
<TabItem Header="Property Validation">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<StackPanel Margin="18" Spacing="4" MinWidth="200" DataContext="{Binding ExceptionDataValidation}">
|
<StackPanel Margin="18" Spacing="4" MinWidth="200" DataContext="{Binding ExceptionDataValidation}">
|
||||||
<TextBlock FontSize="16" Text="Exception Validation"/>
|
<TextBlock FontSize="16" Text="Exception Validation"/>
|
||||||
<TextBox Watermark="Less Than 10" UseFloatingWatermark="True" Text="{Binding Path=LessThan10}"/>
|
<TextBox PlaceholderText="Less Than 10" UseFloatingPlaceholder="True" Text="{Binding Path=LessThan10}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="18" Spacing="4" MinWidth="200" DataContext="{Binding IndeiDataValidation}">
|
<StackPanel Margin="18" Spacing="4" MinWidth="200" DataContext="{Binding IndeiDataValidation}">
|
||||||
<TextBlock FontSize="16" Text="INotifyDataErrorInfo Validation"/>
|
<TextBlock FontSize="16" Text="INotifyDataErrorInfo Validation"/>
|
||||||
<TextBox Watermark="Maximum" UseFloatingWatermark="True" Text="{Binding Path=Maximum}"/>
|
<TextBox PlaceholderText="Maximum" UseFloatingPlaceholder="True" Text="{Binding Path=Maximum}"/>
|
||||||
<TextBox Watermark="Value" UseFloatingWatermark="True" Text="{Binding Path=Value}"/>
|
<TextBox PlaceholderText="Value" UseFloatingPlaceholder="True" Text="{Binding Path=Value}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="18" Spacing="4" MinWidth="200" DataContext="{Binding DataAnnotationsValidation}">
|
<StackPanel Margin="18" Spacing="4" MinWidth="200" DataContext="{Binding DataAnnotationsValidation}">
|
||||||
<TextBlock FontSize="16" Text="Data Annotations Validation"/>
|
<TextBlock FontSize="16" Text="Data Annotations Validation"/>
|
||||||
<TextBox Watermark="Phone #" UseFloatingWatermark="True" Text="{Binding PhoneNumber}"/>
|
<TextBox PlaceholderText="Phone #" UseFloatingPlaceholder="True" Text="{Binding PhoneNumber}"/>
|
||||||
<TextBox Watermark="Less Than 10" UseFloatingWatermark="True" Text="{Binding Path=LessThan10}"/>
|
<TextBox PlaceholderText="Less Than 10" UseFloatingPlaceholder="True" Text="{Binding Path=LessThan10}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -39,8 +39,12 @@
|
|||||||
<AutoCompleteBox MaxDropDownHeight="60" />
|
<AutoCompleteBox MaxDropDownHeight="60" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Watermark" />
|
<TextBlock Text="PlaceholderText" />
|
||||||
<AutoCompleteBox Watermark="Hello World" />
|
<AutoCompleteBox PlaceholderText="Hello World" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="PlaceholderText with custom color" />
|
||||||
|
<AutoCompleteBox PlaceholderText="Search here..." PlaceholderForeground="Green" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Disabled" />
|
<TextBlock Text="Disabled" />
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
x:Class="ControlCatalog.Pages.CalendarDatePickerPage">
|
x:Class="ControlCatalog.Pages.CalendarDatePickerPage">
|
||||||
<StackPanel Orientation="Vertical" Spacing="4">
|
<StackPanel Orientation="Vertical" Spacing="4">
|
||||||
<TextBlock Classes="h2">A control for selecting dates with a calendar drop-down</TextBlock>
|
<TextBlock Classes="h2">A control for selecting dates with a calendar drop-down</TextBlock>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
Margin="0,16,0,0"
|
Margin="0,16,0,0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
@@ -32,19 +32,24 @@
|
|||||||
Margin="0,0,0,8"/>
|
Margin="0,0,0,8"/>
|
||||||
|
|
||||||
<CalendarDatePicker Margin="0,0,0,8"
|
<CalendarDatePicker Margin="0,0,0,8"
|
||||||
Watermark="Watermark"/>
|
PlaceholderText="Placeholder"/>
|
||||||
<CalendarDatePicker Margin="0,0,0,8"
|
<CalendarDatePicker Margin="0,0,0,8"
|
||||||
Name="DatePicker5"
|
Name="DatePicker5"
|
||||||
Watermark="Floating Watermark"
|
PlaceholderText="Floating Placeholder"
|
||||||
UseFloatingWatermark="True"/>
|
UseFloatingPlaceholder="True"/>
|
||||||
|
|
||||||
|
<TextBlock Text="PlaceholderText with custom color"/>
|
||||||
|
<CalendarDatePicker Margin="0,0,0,8"
|
||||||
|
PlaceholderText="Select a date"
|
||||||
|
PlaceholderForeground="Purple"/>
|
||||||
|
|
||||||
<TextBlock Text="Disabled"/>
|
<TextBlock Text="Disabled"/>
|
||||||
<CalendarDatePicker IsEnabled="False"/>
|
<CalendarDatePicker IsEnabled="False"/>
|
||||||
|
|
||||||
<TextBlock Text="Validation Example"/>
|
<TextBlock Text="Validation Example"/>
|
||||||
<CalendarDatePicker SelectedDate="{CompiledBinding ValidatedDateExample, Mode=TwoWay}"/>
|
<CalendarDatePicker SelectedDate="{CompiledBinding ValidatedDateExample, Mode=TwoWay}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<UserControl x:Class="ControlCatalog.Pages.ClipboardPage"
|
<UserControl x:Class="ControlCatalog.Pages.ClipboardPage"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<StackPanel Orientation="Vertical" Spacing="4">
|
<StackPanel Orientation="Vertical" Spacing="4">
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<TextBox x:Name="ClipboardContent"
|
<TextBox x:Name="ClipboardContent"
|
||||||
MinHeight="100"
|
MinHeight="100"
|
||||||
AcceptsReturn="True"
|
AcceptsReturn="True"
|
||||||
Watermark="Text to copy of file names per line" />
|
PlaceholderText="Text to copy of file names per line" />
|
||||||
<Viewbox Width="420" Height="360">
|
<Viewbox Width="420" Height="360">
|
||||||
<Image x:Name="ClipboardImage"
|
<Image x:Name="ClipboardImage"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -58,17 +58,17 @@
|
|||||||
<Button Name="OpenBoth">Select _Both</Button>
|
<Button Name="OpenBoth">Select _Both</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Expander>
|
</Expander>
|
||||||
|
|
||||||
<Expander Header="Launcher dialogs">
|
<Expander Header="Launcher dialogs">
|
||||||
<StackPanel Spacing="4">
|
<StackPanel Spacing="4">
|
||||||
<TextBox Name="UriToLaunch" Watermark="Uri to launch" Text="https://avaloniaui.net/" />
|
<TextBox Name="UriToLaunch" PlaceholderText="Uri to launch" Text="https://avaloniaui.net/" />
|
||||||
<Button Name="LaunchUri">Launch Uri</Button>
|
<Button Name="LaunchUri">Launch Uri</Button>
|
||||||
<Button Name="LaunchFile">Launch File</Button>
|
<Button Name="LaunchFile">Launch File</Button>
|
||||||
<TextBlock Name="LaunchStatus" />
|
<TextBlock Name="LaunchStatus" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Expander>
|
</Expander>
|
||||||
|
|
||||||
<AutoCompleteBox x:Name="CurrentFolderBox" Watermark="Write full path/uri or well known folder name">
|
<AutoCompleteBox x:Name="CurrentFolderBox" PlaceholderText="Write full path/uri or well known folder name">
|
||||||
<AutoCompleteBox.ItemsSource>
|
<AutoCompleteBox.ItemsSource>
|
||||||
<generic:List x:TypeArguments="storage:WellKnownFolder">
|
<generic:List x:TypeArguments="storage:WellKnownFolder">
|
||||||
<storage:WellKnownFolder>Desktop</storage:WellKnownFolder>
|
<storage:WellKnownFolder>Desktop</storage:WellKnownFolder>
|
||||||
@@ -80,17 +80,17 @@
|
|||||||
</generic:List>
|
</generic:List>
|
||||||
</AutoCompleteBox.ItemsSource>
|
</AutoCompleteBox.ItemsSource>
|
||||||
</AutoCompleteBox>
|
</AutoCompleteBox>
|
||||||
|
|
||||||
<TextBlock x:Name="PickerLastResultsVisible"
|
<TextBlock x:Name="PickerLastResultsVisible"
|
||||||
Classes="h2"
|
Classes="h2"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Text="Last picker results:" />
|
Text="Last picker results:" />
|
||||||
<ItemsControl x:Name="PickerLastResults" />
|
<ItemsControl x:Name="PickerLastResults" />
|
||||||
|
|
||||||
<TextBox Name="BookmarkContainer" Watermark="Bookmark" />
|
<TextBox Name="BookmarkContainer" PlaceholderText="Bookmark" />
|
||||||
<TextBox Name="OpenedFileContent"
|
<TextBox Name="OpenedFileContent"
|
||||||
MaxLines="10"
|
MaxLines="10"
|
||||||
Watermark="Picked file content" />
|
PlaceholderText="Picked file content" />
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<UserControl xmlns="https://github.com/avaloniaui"
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:sys="using:System"
|
xmlns:sys="using:System"
|
||||||
xmlns:converter="using:ControlCatalog.Converter"
|
xmlns:converter="using:ControlCatalog.Converter"
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
<ComboBox x:Name="CultureSelector" Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Cultures}"
|
<ComboBox x:Name="CultureSelector" Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Cultures}"
|
||||||
VerticalAlignment="Center" Margin="2"/>
|
VerticalAlignment="Center" Margin="2"/>
|
||||||
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Margin="2">Watermark:</TextBlock>
|
<TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Margin="2">PlaceholderText:</TextBlock>
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding #upDown.Watermark}" VerticalAlignment="Center" Margin="2" />
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding #upDown.PlaceholderText}" VerticalAlignment="Center" Margin="2" />
|
||||||
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Margin="2">Text:</TextBlock>
|
<TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Margin="2">Text:</TextBlock>
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding #upDown.Text}" VerticalAlignment="Center" Margin="2" />
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding #upDown.Text}" VerticalAlignment="Center" Margin="2" />
|
||||||
@@ -81,23 +81,23 @@
|
|||||||
<NumericUpDown Name="upDown" Minimum="0" Maximum="10" Increment="0.5"
|
<NumericUpDown Name="upDown" Minimum="0" Maximum="10" Increment="0.5"
|
||||||
NumberFormat="{Binding #CultureSelector.SelectedItem, Converter={x:Static pages:NumericUpDownPage.CultureConverter}}"
|
NumberFormat="{Binding #CultureSelector.SelectedItem, Converter={x:Static pages:NumericUpDownPage.CultureConverter}}"
|
||||||
VerticalAlignment="Center" Value="{Binding DecimalValue}"
|
VerticalAlignment="Center" Value="{Binding DecimalValue}"
|
||||||
Watermark="Enter text" FormatString="{Binding SelectedFormat.Value}"/>
|
PlaceholderText="Enter text" FormatString="{Binding SelectedFormat.Value}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical" Margin="10">
|
<StackPanel Orientation="Vertical" Margin="10">
|
||||||
<Label Target="DoubleUpDown" FontSize="14" FontWeight="Bold" VerticalAlignment="Center">Usage of double NumericUpDown:</Label>
|
<Label Target="DoubleUpDown" FontSize="14" FontWeight="Bold" VerticalAlignment="Center">Usage of double NumericUpDown:</Label>
|
||||||
<NumericUpDown Name="DoubleUpDown" Minimum="0" Maximum="10" Increment="0.5"
|
<NumericUpDown Name="DoubleUpDown" Minimum="0" Maximum="10" Increment="0.5"
|
||||||
VerticalAlignment="Center" Value="{Binding DoubleValue}"
|
VerticalAlignment="Center" Value="{Binding DoubleValue}"
|
||||||
Watermark="Enter text" FormatString="{Binding SelectedFormat.Value}"/>
|
PlaceholderText="Enter text" FormatString="{Binding SelectedFormat.Value}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical" Margin="10">
|
<StackPanel Orientation="Vertical" Margin="10">
|
||||||
<Label Target="ValidationUpDown" FontSize="14" FontWeight="Bold" VerticalAlignment="Center">NumericUpDown with Validation Errors:</Label>
|
<Label Target="ValidationUpDown" FontSize="14" FontWeight="Bold" VerticalAlignment="Center">NumericUpDown with Validation Errors:</Label>
|
||||||
<NumericUpDown x:Name="ValidationUpDown" Minimum="0" Maximum="10" Increment="0.5"
|
<NumericUpDown x:Name="ValidationUpDown" Minimum="0" Maximum="10" Increment="0.5"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Watermark="Enter text" FormatString="{Binding SelectedFormat.Value}">
|
PlaceholderText="Enter text" FormatString="{Binding SelectedFormat.Value}">
|
||||||
<DataValidationErrors.Error>
|
<DataValidationErrors.Error>
|
||||||
<sys:Exception />
|
<sys:Exception />
|
||||||
</DataValidationErrors.Error>
|
</DataValidationErrors.Error>
|
||||||
</NumericUpDown>
|
</NumericUpDown>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -110,10 +110,18 @@
|
|||||||
<converter:HexConverter></converter:HexConverter>
|
<converter:HexConverter></converter:HexConverter>
|
||||||
</NumericUpDown.TextConverter>
|
</NumericUpDown.TextConverter>
|
||||||
</NumericUpDown>
|
</NumericUpDown>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Vertical" Margin="10">
|
||||||
|
<Label FontSize="14" FontWeight="Bold" Target="PlaceholderForegroundUpDown"
|
||||||
|
Content="Placeholder with custom foreground color:"/>
|
||||||
|
<NumericUpDown x:Name="PlaceholderForegroundUpDown"
|
||||||
|
PlaceholderText="Enter amount"
|
||||||
|
PlaceholderForeground="Orange"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Margin="10">
|
<StackPanel Margin="10">
|
||||||
<Label FontSize="14" FontWeight="Bold" Target="InnerContent"
|
<Label FontSize="14" FontWeight="Bold" Target="InnerContent"
|
||||||
Content="Inner Contents"/>
|
Content="Inner Contents"/>
|
||||||
|
|||||||
@@ -17,34 +17,41 @@
|
|||||||
</Flyout>
|
</Flyout>
|
||||||
</TextBox.ContextFlyout>
|
</TextBox.ContextFlyout>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<TextBox Width="200" Watermark="ReadOnly" IsReadOnly="True" Text="This is read only"/>
|
<TextBox Width="200" PlaceholderText="ReadOnly" IsReadOnly="True" Text="This is read only"/>
|
||||||
<TextBox Width="200" Watermark="Numeric with watermark" TextInputOptions.ContentType="Number" />
|
<TextBox Width="200" PlaceholderText="Numeric with placeholder" TextInputOptions.ContentType="Number" />
|
||||||
<TextBox Width="200"
|
<TextBox Width="200"
|
||||||
Watermark="Floating Watermark"
|
PlaceholderText="Floating Placeholder"
|
||||||
UseFloatingWatermark="True"
|
UseFloatingPlaceholder="True"
|
||||||
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
|
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
|
||||||
|
<TextBox Width="200"
|
||||||
|
PlaceholderText="Custom Placeholder Color"
|
||||||
|
PlaceholderForeground="Red"/>
|
||||||
|
<TextBox Width="200"
|
||||||
|
PlaceholderText="Floating Placeholder Color"
|
||||||
|
UseFloatingPlaceholder="True"
|
||||||
|
PlaceholderForeground="Purple"/>
|
||||||
<MaskedTextBox Width="200" ResetOnSpace="False" Mask="(LLL) 999-0000"/>
|
<MaskedTextBox Width="200" ResetOnSpace="False" Mask="(LLL) 999-0000"/>
|
||||||
|
|
||||||
<TextBox Width="200" Text="Validation Error">
|
<TextBox Width="200" Text="Validation Error">
|
||||||
<DataValidationErrors.Error>
|
<DataValidationErrors.Error>
|
||||||
<sys:Exception />
|
<sys:Exception />
|
||||||
</DataValidationErrors.Error>
|
</DataValidationErrors.Error>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<TextBox Width="200"
|
<TextBox Width="200"
|
||||||
Watermark="Password Box"
|
PlaceholderText="Password Box"
|
||||||
Classes="revealPasswordButton"
|
Classes="revealPasswordButton"
|
||||||
TextInputOptions.ContentType="Password"
|
TextInputOptions.ContentType="Password"
|
||||||
UseFloatingWatermark="True"
|
UseFloatingPlaceholder="True"
|
||||||
PasswordChar="*"
|
PasswordChar="*"
|
||||||
Text="Password" />
|
Text="Password" />
|
||||||
<TextBox Width="200" Watermark="Suggestions are hidden" TextInputOptions.ShowSuggestions="False" />
|
<TextBox Width="200" PlaceholderText="Suggestions are hidden" TextInputOptions.ShowSuggestions="False" />
|
||||||
<TextBox Width="200" Text="Left aligned text" TextAlignment="Left" AcceptsTab="True" />
|
<TextBox Width="200" Text="Left aligned text" TextAlignment="Left" AcceptsTab="True" />
|
||||||
<TextBox Width="200" Text="Center aligned text" TextAlignment="Center" />
|
<TextBox Width="200" Text="Center aligned text" TextAlignment="Center" />
|
||||||
<TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
|
<TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
|
||||||
<TextBox Width="200" Text="Custom selection brush"
|
<TextBox Width="200" Text="Custom selection brush"
|
||||||
SelectionStart="5" SelectionEnd="22"
|
SelectionStart="5" SelectionEnd="22"
|
||||||
SelectionBrush="Green" SelectionForegroundBrush="Yellow" ClearSelectionOnLostFocus="False"/>
|
SelectionBrush="Green" SelectionForegroundBrush="Yellow" ClearSelectionOnLostFocus="False"/>
|
||||||
<TextBox Width="200" Text="Custom caret brush" CaretBrush="DarkOrange"/>
|
<TextBox Width="200" Text="Custom caret brush" CaretBrush="DarkOrange"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
@@ -54,11 +61,11 @@
|
|||||||
<TextBox AcceptsReturn="True" Width="200" Height="125"
|
<TextBox AcceptsReturn="True" Width="200" Height="125"
|
||||||
Text="Multiline TextBox with no TextWrapping.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
|
Text="Multiline TextBox with no TextWrapping.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
|
||||||
|
|
||||||
<TextBox Classes="clearButton" Text="Clear Content" Width="200" FontWeight="Normal" FontStyle="Normal" Watermark="Watermark" FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro"/>
|
<TextBox Classes="clearButton" Text="Clear Content" Width="200" FontWeight="Normal" FontStyle="Normal" PlaceholderText="Placeholder" FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro"/>
|
||||||
<TextBox Text="IME small font" Width="200"
|
<TextBox Text="IME small font" Width="200"
|
||||||
FontFamily="Comic Sans MS"
|
FontFamily="Comic Sans MS"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="Red"/>
|
Foreground="Red"/>
|
||||||
<TextBox Text="IME large font" Width="200"
|
<TextBox Text="IME large font" Width="200"
|
||||||
FontFamily="Comic Sans MS"
|
FontFamily="Comic Sans MS"
|
||||||
FontSize="22"
|
FontSize="22"
|
||||||
@@ -67,9 +74,9 @@
|
|||||||
FontFamily="Comic Sans MS"
|
FontFamily="Comic Sans MS"
|
||||||
InputMethod.IsInputMethodEnabled="False"
|
InputMethod.IsInputMethodEnabled="False"
|
||||||
Foreground="Red"/>
|
Foreground="Red"/>
|
||||||
<TextBox AcceptsReturn="True"
|
<TextBox AcceptsReturn="True"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
Width="200"
|
Width="200"
|
||||||
Height="125"
|
Height="125"
|
||||||
LineHeight="32"
|
LineHeight="32"
|
||||||
Text="Multiline TextBox with TextWrapping and increased LineHeight.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
|
Text="Multiline TextBox with TextWrapping and increased LineHeight.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<UserControl x:Class="ControlCatalog.Pages.ThemePage"
|
<UserControl x:Class="ControlCatalog.Pages.ThemePage"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -70,8 +70,8 @@
|
|||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="Username:" VerticalAlignment="Center" />
|
<TextBlock Grid.Column="0" Grid.Row="2" Text="Username:" VerticalAlignment="Center" />
|
||||||
<TextBlock Grid.Column="0" Grid.Row="4" Text="Password:" VerticalAlignment="Center" />
|
<TextBlock Grid.Column="0" Grid.Row="4" Text="Password:" VerticalAlignment="Center" />
|
||||||
<TextBox Grid.Column="1" Grid.Row="2" Watermark="Input here" HorizontalAlignment="Stretch" />
|
<TextBox Grid.Column="1" Grid.Row="2" PlaceholderText="Input here" HorizontalAlignment="Stretch" />
|
||||||
<TextBox Grid.Column="1" Grid.Row="4" Watermark="Input here" HorizontalAlignment="Stretch" />
|
<TextBox Grid.Column="1" Grid.Row="4" PlaceholderText="Input here" HorizontalAlignment="Stretch" />
|
||||||
<Button Grid.Column="1" Grid.Row="6" Content="Login" HorizontalAlignment="Stretch" />
|
<Button Grid.Column="1" Grid.Row="6" Content="Login" HorizontalAlignment="Stretch" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<UserControl xmlns="https://github.com/avaloniaui"
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="using:Generators.Sandbox.Controls"
|
xmlns:controls="using:Generators.Sandbox.Controls"
|
||||||
xmlns:vm="clr-namespace:Generators.Sandbox.ViewModels"
|
xmlns:vm="clr-namespace:Generators.Sandbox.ViewModels"
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
<controls:CustomTextBox Margin="0 10 0 0"
|
<controls:CustomTextBox Margin="0 10 0 0"
|
||||||
x:Name="UserNameTextBox"
|
x:Name="UserNameTextBox"
|
||||||
Text="{Binding UserName}"
|
Text="{Binding UserName}"
|
||||||
Watermark="Please, enter user name..."
|
PlaceholderText="Please, enter user name..."
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBlock x:Name="UserNameValidation"
|
<TextBlock x:Name="UserNameValidation"
|
||||||
Text="{Binding UserNameValidation}"
|
Text="{Binding UserNameValidation}"
|
||||||
Foreground="Green"
|
Foreground="Green"
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
<TextBox Margin="0 10 0 0"
|
<TextBox Margin="0 10 0 0"
|
||||||
x:Name="PasswordTextBox"
|
x:Name="PasswordTextBox"
|
||||||
Text="{Binding Password}"
|
Text="{Binding Password}"
|
||||||
Watermark="Please, enter your password..."
|
PlaceholderText="Please, enter your password..."
|
||||||
UseFloatingWatermark="True"
|
UseFloatingPlaceholder="True"
|
||||||
PasswordChar="*" />
|
PasswordChar="*" />
|
||||||
<TextBlock x:Name="PasswordValidation"
|
<TextBlock x:Name="PasswordValidation"
|
||||||
Text="{Binding PasswordValidation}"
|
Text="{Binding PasswordValidation}"
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
<TextBox Margin="0 10 0 0"
|
<TextBox Margin="0 10 0 0"
|
||||||
x:Name="ConfirmPasswordTextBox"
|
x:Name="ConfirmPasswordTextBox"
|
||||||
Text="{Binding ConfirmPassword}"
|
Text="{Binding ConfirmPassword}"
|
||||||
Watermark="Please, confirm the password..."
|
PlaceholderText="Please, confirm the password..."
|
||||||
UseFloatingWatermark="True"
|
UseFloatingPlaceholder="True"
|
||||||
PasswordChar="*" />
|
PasswordChar="*" />
|
||||||
<TextBlock x:Name="ConfirmPasswordValidation"
|
<TextBlock x:Name="ConfirmPasswordValidation"
|
||||||
Text="{Binding ConfirmPasswordValidation}"
|
Text="{Binding ConfirmPasswordValidation}"
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
<Button Name="ScreenRefresh"
|
<Button Name="ScreenRefresh"
|
||||||
Content="Refresh"
|
Content="Refresh"
|
||||||
Click="ScreenRefresh_Click"/>
|
Click="ScreenRefresh_Click"/>
|
||||||
<TextBox Name="ScreenName" Watermark="DisplayName" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenName" PlaceholderText="DisplayName" UseFloatingPlaceholder="true" />
|
||||||
<TextBox Name="ScreenHandle" Watermark="Handle" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenHandle" PlaceholderText="Handle" UseFloatingPlaceholder="true" />
|
||||||
<TextBox Name="ScreenScaling" Watermark="Scaling" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenScaling" PlaceholderText="Scaling" UseFloatingPlaceholder="true" />
|
||||||
<TextBox Name="ScreenBounds" Watermark="Bounds" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenBounds" PlaceholderText="Bounds" UseFloatingPlaceholder="true" />
|
||||||
<TextBox Name="ScreenWorkArea" Watermark="WorkArea" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenWorkArea" PlaceholderText="WorkArea" UseFloatingPlaceholder="true" />
|
||||||
<TextBox Name="ScreenOrientation" Watermark="Orientation" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenOrientation" PlaceholderText="Orientation" UseFloatingPlaceholder="true" />
|
||||||
<TextBox Name="ScreenSameReference" Watermark="Is same reference" UseFloatingWatermark="true" />
|
<TextBox Name="ScreenSameReference" PlaceholderText="Is same reference" UseFloatingPlaceholder="true" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<CheckBox Name="WindowPreferSystemChrome" Content="Prefer SystemChrome" />
|
<CheckBox Name="WindowPreferSystemChrome" Content="Prefer SystemChrome" />
|
||||||
<CheckBox Name="WindowMacThickSystemChrome" Content="Mac Thick SystemChrome" />
|
<CheckBox Name="WindowMacThickSystemChrome" Content="Mac Thick SystemChrome" />
|
||||||
<CheckBox Name="WindowShowTitleAreaControl" Content="Show Title Area Control" />
|
<CheckBox Name="WindowShowTitleAreaControl" Content="Show Title Area Control" />
|
||||||
<TextBox Name="WindowTitleBarHeightHint" Text="-1" Watermark="In dips" />
|
<TextBox Name="WindowTitleBarHeightHint" Text="-1" PlaceholderText="In dips" />
|
||||||
<Button Name="ApplyWindowDecorations"
|
<Button Name="ApplyWindowDecorations"
|
||||||
Content="Apply decorations on this Window"
|
Content="Apply decorations on this Window"
|
||||||
Click="ApplyWindowDecorations_Click"/>
|
Click="ApplyWindowDecorations_Click"/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
x:Class="IntegrationTestApp.Pages.WindowPage">
|
x:Class="IntegrationTestApp.Pages.WindowPage">
|
||||||
<Grid ColumnDefinitions="*,8,*">
|
<Grid ColumnDefinitions="*,8,*">
|
||||||
<StackPanel Grid.Column="0">
|
<StackPanel Grid.Column="0">
|
||||||
<TextBox Name="ShowWindowSize" Watermark="Window Size"/>
|
<TextBox Name="ShowWindowSize" PlaceholderText="Window Size"/>
|
||||||
<ComboBox Name="ShowWindowMode" SelectedIndex="0">
|
<ComboBox Name="ShowWindowMode" SelectedIndex="0">
|
||||||
<ComboBoxItem>NonOwned</ComboBoxItem>
|
<ComboBoxItem>NonOwned</ComboBoxItem>
|
||||||
<ComboBoxItem>Owned</ComboBoxItem>
|
<ComboBoxItem>Owned</ComboBoxItem>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<Label Margin="5"
|
<Label Margin="5"
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
HorizontalContentAlignment="Right">View Bounds</Label>
|
HorizontalContentAlignment="Right">View Bounds</Label>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<Border BorderBrush="LimeGreen"
|
<Border BorderBrush="LimeGreen"
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<CheckBox IsChecked="{Binding UseSafeArea}" IsEnabled="{Binding !AutoSafeAreaPadding}">Use Safe Area</CheckBox>
|
<CheckBox IsChecked="{Binding UseSafeArea}" IsEnabled="{Binding !AutoSafeAreaPadding}">Use Safe Area</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding AutoSafeAreaPadding}">Automatic Paddings</CheckBox>
|
<CheckBox IsChecked="{Binding AutoSafeAreaPadding}">Automatic Paddings</CheckBox>
|
||||||
<CheckBox IsChecked="{Binding HideSystemBars}">Hide System Bars</CheckBox>
|
<CheckBox IsChecked="{Binding HideSystemBars}">Hide System Bars</CheckBox>
|
||||||
<TextBox Width="200" Watermark="Tap to Show Keyboard"/>
|
<TextBox Width="200" PlaceholderText="Tap to Show Keyboard"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
x:DataType="local:MainView">
|
x:DataType="local:MainView">
|
||||||
<StackPanel Margin="100 50" Spacing="50">
|
<StackPanel Margin="100 50" Spacing="50">
|
||||||
<TextBlock Text="Login" Foreground="White" />
|
<TextBlock Text="Login" Foreground="White" />
|
||||||
<TextBox TextInputOptions.Multiline="True" AcceptsReturn="True" Watermark="Text" Height="200" TextWrapping="Wrap"/>
|
<TextBox TextInputOptions.Multiline="True" AcceptsReturn="True" PlaceholderText="Text" Height="200" TextWrapping="Wrap"/>
|
||||||
<TextBox Watermark="Username" TextInputOptions.ContentType="Email" TextInputOptions.ReturnKeyType="Done" />
|
<TextBox PlaceholderText="Username" TextInputOptions.ContentType="Email" TextInputOptions.ReturnKeyType="Done" />
|
||||||
<TextBox Watermark="Password" PasswordChar="*" TextInputOptions.ContentType="Password" />
|
<TextBox PlaceholderText="Password" PasswordChar="*" TextInputOptions.ContentType="Password" />
|
||||||
<TextBox Watermark="Pin" PasswordChar="*" TextInputOptions.ContentType="Digits" TextInputOptions.ReturnKeyType="Next" />
|
<TextBox PlaceholderText="Pin" PasswordChar="*" TextInputOptions.ContentType="Digits" TextInputOptions.ReturnKeyType="Next" />
|
||||||
<Button Content="Login" Command="{Binding ButtonCommand}" />
|
<Button Content="Login" Command="{Binding ButtonCommand}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// (c) Copyright Microsoft Corporation.
|
// (c) Copyright Microsoft Corporation.
|
||||||
// This source is subject to the Microsoft Public License (Ms-PL).
|
// This source is subject to the Microsoft Public License (Ms-PL).
|
||||||
// Please see https://go.microsoft.com/fwlink/?LinkID=131993 for details.
|
// Please see https://go.microsoft.com/fwlink/?LinkID=131993 for details.
|
||||||
// All other rights reserved.
|
// All other rights reserved.
|
||||||
@@ -24,8 +24,37 @@ namespace Avalonia.Controls
|
|||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
defaultBindingMode: BindingMode.TwoWay));
|
defaultBindingMode: BindingMode.TwoWay));
|
||||||
|
|
||||||
public static readonly StyledProperty<string?> WatermarkProperty =
|
/// <summary>
|
||||||
TextBox.WatermarkProperty.AddOwner<AutoCompleteBox>();
|
/// Defines the <see cref="PlaceholderText"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1013",
|
||||||
|
Justification = "We keep WatermarkProperty for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<string?> PlaceholderTextProperty =
|
||||||
|
TextBox.PlaceholderTextProperty.AddOwner<AutoCompleteBox>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="Watermark"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderTextProperty instead.", false)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<string?> WatermarkProperty = PlaceholderTextProperty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="PlaceholderForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1013",
|
||||||
|
Justification = "We keep WatermarkForegroundProperty for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<Media.IBrush?> PlaceholderForegroundProperty =
|
||||||
|
TextBox.PlaceholderForegroundProperty.AddOwner<AutoCompleteBox>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="WatermarkForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForegroundProperty instead.", false)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<Media.IBrush?> WatermarkForegroundProperty = PlaceholderForegroundProperty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the <see cref="MinimumPrefixLength" /> property.
|
/// Identifies the <see cref="MinimumPrefixLength" /> property.
|
||||||
@@ -406,10 +435,46 @@ namespace Avalonia.Controls
|
|||||||
set => SetValue(FilterModeProperty, value);
|
set => SetValue(FilterModeProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the placeholder or descriptive text that is displayed even if the text is not yet set.
|
||||||
|
/// </summary>
|
||||||
|
public string? PlaceholderText
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderTextProperty);
|
||||||
|
set => SetValue(PlaceholderTextProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the placeholder or descriptive text that is displayed even if the text is not yet set.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderText instead.", false)]
|
||||||
public string? Watermark
|
public string? Watermark
|
||||||
{
|
{
|
||||||
get => GetValue(WatermarkProperty);
|
get => PlaceholderText;
|
||||||
set => SetValue(WatermarkProperty, value);
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush used for the foreground color of the placeholder text.
|
||||||
|
/// </summary>
|
||||||
|
public Media.IBrush? PlaceholderForeground
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderForegroundProperty);
|
||||||
|
set => SetValue(PlaceholderForegroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush used for the foreground color of the placeholder text.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForeground instead.", false)]
|
||||||
|
public Media.IBrush? WatermarkForeground
|
||||||
|
{
|
||||||
|
get => PlaceholderForeground;
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderForeground = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
using Avalonia.Layout;
|
using Avalonia.Layout;
|
||||||
@@ -53,7 +53,7 @@ namespace Avalonia.Controls
|
|||||||
public static readonly StyledProperty<DateTime?> SelectedDateProperty =
|
public static readonly StyledProperty<DateTime?> SelectedDateProperty =
|
||||||
AvaloniaProperty.Register<CalendarDatePicker, DateTime?>(
|
AvaloniaProperty.Register<CalendarDatePicker, DateTime?>(
|
||||||
nameof(SelectedDate),
|
nameof(SelectedDate),
|
||||||
enableDataValidation: true,
|
enableDataValidation: true,
|
||||||
defaultBindingMode:BindingMode.TwoWay);
|
defaultBindingMode:BindingMode.TwoWay);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,17 +80,53 @@ namespace Avalonia.Controls
|
|||||||
public static readonly StyledProperty<string?> TextProperty =
|
public static readonly StyledProperty<string?> TextProperty =
|
||||||
AvaloniaProperty.Register<CalendarDatePicker, string?>(nameof(Text));
|
AvaloniaProperty.Register<CalendarDatePicker, string?>(nameof(Text));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="PlaceholderText"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1013",
|
||||||
|
Justification = "We keep WatermarkProperty for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<string?> PlaceholderTextProperty =
|
||||||
|
TextBox.PlaceholderTextProperty.AddOwner<CalendarDatePicker>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="Watermark"/> property.
|
/// Defines the <see cref="Watermark"/> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<string?> WatermarkProperty =
|
[Obsolete("Use PlaceholderTextProperty instead.", false)]
|
||||||
TextBox.WatermarkProperty.AddOwner<CalendarDatePicker>();
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<string?> WatermarkProperty = PlaceholderTextProperty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="UseFloatingPlaceholder"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1013",
|
||||||
|
Justification = "We keep UseFloatingWatermarkProperty for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<bool> UseFloatingPlaceholderProperty =
|
||||||
|
TextBox.UseFloatingPlaceholderProperty.AddOwner<CalendarDatePicker>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="UseFloatingWatermark"/> property.
|
/// Defines the <see cref="UseFloatingWatermark"/> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<bool> UseFloatingWatermarkProperty =
|
[Obsolete("Use UseFloatingPlaceholderProperty instead.", false)]
|
||||||
TextBox.UseFloatingWatermarkProperty.AddOwner<CalendarDatePicker>();
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<bool> UseFloatingWatermarkProperty = UseFloatingPlaceholderProperty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="PlaceholderForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1013",
|
||||||
|
Justification = "We keep WatermarkForegroundProperty for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<Media.IBrush?> PlaceholderForegroundProperty =
|
||||||
|
TextBox.PlaceholderForegroundProperty.AddOwner<CalendarDatePicker>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="WatermarkForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForegroundProperty instead.", false)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<Media.IBrush?> WatermarkForegroundProperty = PlaceholderForegroundProperty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="HorizontalContentAlignment"/> property.
|
/// Defines the <see cref="HorizontalContentAlignment"/> property.
|
||||||
@@ -130,7 +166,7 @@ namespace Avalonia.Controls
|
|||||||
get => GetValue(DisplayDateProperty);
|
get => GetValue(DisplayDateProperty);
|
||||||
set => SetValue(DisplayDateProperty, value);
|
set => SetValue(DisplayDateProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the first date to be displayed.
|
/// Gets or sets the first date to be displayed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -254,18 +290,55 @@ namespace Avalonia.Controls
|
|||||||
set => SetValue(TextProperty, value);
|
set => SetValue(TextProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="TextBox.PlaceholderText"/>
|
||||||
|
public string? PlaceholderText
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderTextProperty);
|
||||||
|
set => SetValue(PlaceholderTextProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="TextBox.Watermark"/>
|
/// <inheritdoc cref="TextBox.Watermark"/>
|
||||||
|
[Obsolete("Use PlaceholderText instead.", false)]
|
||||||
public string? Watermark
|
public string? Watermark
|
||||||
{
|
{
|
||||||
get => GetValue(WatermarkProperty);
|
get => PlaceholderText;
|
||||||
set => SetValue(WatermarkProperty, value);
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="TextBox.UseFloatingPlaceholder"/>
|
||||||
|
public bool UseFloatingPlaceholder
|
||||||
|
{
|
||||||
|
get => GetValue(UseFloatingPlaceholderProperty);
|
||||||
|
set => SetValue(UseFloatingPlaceholderProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="TextBox.UseFloatingWatermark"/>
|
/// <inheritdoc cref="TextBox.UseFloatingWatermark"/>
|
||||||
|
[Obsolete("Use UseFloatingPlaceholder instead.", false)]
|
||||||
public bool UseFloatingWatermark
|
public bool UseFloatingWatermark
|
||||||
{
|
{
|
||||||
get => GetValue(UseFloatingWatermarkProperty);
|
get => UseFloatingPlaceholder;
|
||||||
set => SetValue(UseFloatingWatermarkProperty, value);
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => UseFloatingPlaceholder = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="TextBox.PlaceholderForeground"/>
|
||||||
|
public Media.IBrush? PlaceholderForeground
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderForegroundProperty);
|
||||||
|
set => SetValue(PlaceholderForegroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="TextBox.WatermarkForeground"/>
|
||||||
|
[Obsolete("Use PlaceholderForeground instead.", false)]
|
||||||
|
public Media.IBrush? WatermarkForeground
|
||||||
|
{
|
||||||
|
get => PlaceholderForeground;
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderForeground = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ namespace Avalonia.Controls
|
|||||||
|
|
||||||
private void Calendar_PointerReleased(object? sender, PointerReleasedEventArgs e)
|
private void Calendar_PointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (e.InitialPressMouseButton == MouseButton.Left)
|
if (e.InitialPressMouseButton == MouseButton.Left)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
@@ -779,7 +779,7 @@ namespace Avalonia.Controls
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Key.Down:
|
case Key.Down:
|
||||||
{
|
{
|
||||||
if ((e.KeyModifiers & KeyModifiers.Control) == KeyModifiers.Control)
|
if ((e.KeyModifiers & KeyModifiers.Control) == KeyModifiers.Control)
|
||||||
{
|
{
|
||||||
TogglePopUp();
|
TogglePopUp();
|
||||||
@@ -816,7 +816,7 @@ namespace Avalonia.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DateTime? d = SetTextBoxValue(s);
|
DateTime? d = SetTextBoxValue(s);
|
||||||
|
|
||||||
if (SelectedDate != d)
|
if (SelectedDate != d)
|
||||||
{
|
{
|
||||||
SetCurrentValue(SelectedDateProperty, d);
|
SetCurrentValue(SelectedDateProperty, d);
|
||||||
@@ -880,39 +880,39 @@ namespace Avalonia.Controls
|
|||||||
if (_textBox != null)
|
if (_textBox != null)
|
||||||
{
|
{
|
||||||
SetCurrentValue(TextProperty, String.Empty);
|
SetCurrentValue(TextProperty, String.Empty);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Watermark) && !UseFloatingWatermark)
|
if (string.IsNullOrEmpty(PlaceholderText) && !UseFloatingPlaceholder)
|
||||||
{
|
{
|
||||||
DateTimeFormatInfo dtfi = DateTimeHelper.GetCurrentDateFormat();
|
DateTimeFormatInfo dtfi = DateTimeHelper.GetCurrentDateFormat();
|
||||||
_defaultText = string.Empty;
|
_defaultText = string.Empty;
|
||||||
var watermarkFormat = "<{0}>";
|
var placeholderFormat = "<{0}>";
|
||||||
string watermarkText;
|
string placeholderText;
|
||||||
|
|
||||||
switch (SelectedDateFormat)
|
switch (SelectedDateFormat)
|
||||||
{
|
{
|
||||||
case CalendarDatePickerFormat.Custom:
|
case CalendarDatePickerFormat.Custom:
|
||||||
{
|
{
|
||||||
watermarkText = string.Format(CultureInfo.CurrentCulture, watermarkFormat, CustomDateFormatString);
|
placeholderText = string.Format(CultureInfo.CurrentCulture, placeholderFormat, CustomDateFormatString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CalendarDatePickerFormat.Long:
|
case CalendarDatePickerFormat.Long:
|
||||||
{
|
{
|
||||||
watermarkText = string.Format(CultureInfo.CurrentCulture, watermarkFormat, dtfi.LongDatePattern.ToString());
|
placeholderText = string.Format(CultureInfo.CurrentCulture, placeholderFormat, dtfi.LongDatePattern.ToString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CalendarDatePickerFormat.Short:
|
case CalendarDatePickerFormat.Short:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
watermarkText = string.Format(CultureInfo.CurrentCulture, watermarkFormat, dtfi.ShortDatePattern.ToString());
|
placeholderText = string.Format(CultureInfo.CurrentCulture, placeholderFormat, dtfi.ShortDatePattern.ToString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_textBox.Watermark = watermarkText;
|
_textBox.PlaceholderText = placeholderText;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_textBox.ClearValue(TextBox.WatermarkProperty);
|
_textBox.ClearValue(TextBox.PlaceholderTextProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -108,11 +108,35 @@ namespace Avalonia.Controls
|
|||||||
AvaloniaProperty.Register<NumericUpDown, decimal?>(nameof(Value), coerce: (s,v) => ((NumericUpDown)s).OnCoerceValue(v),
|
AvaloniaProperty.Register<NumericUpDown, decimal?>(nameof(Value), coerce: (s,v) => ((NumericUpDown)s).OnCoerceValue(v),
|
||||||
defaultBindingMode: BindingMode.TwoWay, enableDataValidation: true);
|
defaultBindingMode: BindingMode.TwoWay, enableDataValidation: true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="PlaceholderText"/> property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly StyledProperty<string?> PlaceholderTextProperty =
|
||||||
|
AvaloniaProperty.Register<NumericUpDown, string?>(nameof(PlaceholderText));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="Watermark"/> property.
|
/// Defines the <see cref="Watermark"/> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<string?> WatermarkProperty =
|
[Obsolete("Use PlaceholderTextProperty instead.", false)]
|
||||||
AvaloniaProperty.Register<NumericUpDown, string?>(nameof(Watermark));
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<string?> WatermarkProperty = PlaceholderTextProperty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="PlaceholderForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1013",
|
||||||
|
Justification = "We keep WatermarkForegroundProperty for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<Media.IBrush?> PlaceholderForegroundProperty =
|
||||||
|
TextBox.PlaceholderForegroundProperty.AddOwner<NumericUpDown>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="WatermarkForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForegroundProperty instead.", false)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<Media.IBrush?> WatermarkForegroundProperty = PlaceholderForegroundProperty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="HorizontalContentAlignment"/> property.
|
/// Defines the <see cref="HorizontalContentAlignment"/> property.
|
||||||
@@ -253,7 +277,7 @@ namespace Avalonia.Controls
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the parsing style (AllowLeadingWhite, Float, AllowHexSpecifier, ...). By default, Any.
|
/// Gets or sets the parsing style (AllowLeadingWhite, Float, AllowHexSpecifier, ...). By default, Any.
|
||||||
/// Note that Hex style does not work with decimal.
|
/// Note that Hex style does not work with decimal.
|
||||||
/// For hexadecimal display, use <see cref="TextConverter"/>.
|
/// For hexadecimal display, use <see cref="TextConverter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NumberStyles ParsingNumberStyle
|
public NumberStyles ParsingNumberStyle
|
||||||
@@ -273,7 +297,7 @@ namespace Avalonia.Controls
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the custom bidirectional Text-Value converter.
|
/// Gets or sets the custom bidirectional Text-Value converter.
|
||||||
/// Non-null converter overrides <see cref="ParsingNumberStyle"/>, providing finer control over
|
/// Non-null converter overrides <see cref="ParsingNumberStyle"/>, providing finer control over
|
||||||
/// string representation of the underlying value.
|
/// string representation of the underlying value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IValueConverter? TextConverter
|
public IValueConverter? TextConverter
|
||||||
@@ -292,12 +316,45 @@ namespace Avalonia.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the object to use as a watermark if the <see cref="Value"/> is null.
|
/// Gets or sets the object to use as a placeholder if the <see cref="Value"/> is null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public string? PlaceholderText
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderTextProperty);
|
||||||
|
set => SetValue(PlaceholderTextProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the object to use as a placeholder if the <see cref="Value"/> is null.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderText instead.", false)]
|
||||||
public string? Watermark
|
public string? Watermark
|
||||||
{
|
{
|
||||||
get => GetValue(WatermarkProperty);
|
get => PlaceholderText;
|
||||||
set => SetValue(WatermarkProperty, value);
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush used for the foreground color of the placeholder text.
|
||||||
|
/// </summary>
|
||||||
|
public Media.IBrush? PlaceholderForeground
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderForegroundProperty);
|
||||||
|
set => SetValue(PlaceholderForegroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush used for the foreground color of the placeholder text.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForeground instead.", false)]
|
||||||
|
public Media.IBrush? WatermarkForeground
|
||||||
|
{
|
||||||
|
get => PlaceholderForeground;
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderForeground = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -700,8 +757,8 @@ namespace Avalonia.Controls
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if Minimum is set we set value to Minimum on Increment.
|
// if Minimum is set we set value to Minimum on Increment.
|
||||||
// otherwise we set value to 0. It ill be clamped to be between Minimum and Maximum later, so we don't need to do it here.
|
// otherwise we set value to 0. It ill be clamped to be between Minimum and Maximum later, so we don't need to do it here.
|
||||||
result = IsSet(MinimumProperty) ? Minimum : 0;
|
result = IsSet(MinimumProperty) ? Minimum : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,8 +778,8 @@ namespace Avalonia.Controls
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if Maximum is set we set value to Maximum on decrement.
|
// if Maximum is set we set value to Maximum on decrement.
|
||||||
// otherwise we set value to 0. It ill be clamped to be between Minimum and Maximum later, so we don't need to do it here.
|
// otherwise we set value to 0. It ill be clamped to be between Minimum and Maximum later, so we don't need to do it here.
|
||||||
result = IsSet(MaximumProperty) ? Maximum : 0;
|
result = IsSet(MaximumProperty) ? Maximum : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ namespace Avalonia.Controls
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="IsInactiveSelectionHighlightEnabled"/> property
|
/// Defines the <see cref="IsInactiveSelectionHighlightEnabled"/> property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<bool> IsInactiveSelectionHighlightEnabledProperty =
|
public static readonly StyledProperty<bool> IsInactiveSelectionHighlightEnabledProperty =
|
||||||
AvaloniaProperty.Register<TextBox, bool>(nameof(IsInactiveSelectionHighlightEnabled), defaultValue: true);
|
AvaloniaProperty.Register<TextBox, bool>(nameof(IsInactiveSelectionHighlightEnabled), defaultValue: true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="ClearSelectionOnLostFocus"/> property
|
/// Defines the <see cref="ClearSelectionOnLostFocus"/> property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<bool> ClearSelectionOnLostFocusProperty =
|
public static readonly StyledProperty<bool> ClearSelectionOnLostFocusProperty =
|
||||||
AvaloniaProperty.Register<TextBox, bool>(nameof(ClearSelectionOnLostFocus), defaultValue: true);
|
AvaloniaProperty.Register<TextBox, bool>(nameof(ClearSelectionOnLostFocus), defaultValue: true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -181,16 +181,46 @@ namespace Avalonia.Controls
|
|||||||
TextBlock.LineHeightProperty.AddOwner<TextBox>(new(defaultValue: double.NaN));
|
TextBlock.LineHeightProperty.AddOwner<TextBox>(new(defaultValue: double.NaN));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="Watermark"/> property
|
/// Defines the <see cref="PlaceholderText"/> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<string?> WatermarkProperty =
|
public static readonly StyledProperty<string?> PlaceholderTextProperty =
|
||||||
AvaloniaProperty.Register<TextBox, string?>(nameof(Watermark));
|
AvaloniaProperty.Register<TextBox, string?>(nameof(PlaceholderText));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="UseFloatingWatermark"/> property
|
/// Defines the <see cref="Watermark"/> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<bool> UseFloatingWatermarkProperty =
|
[Obsolete("Use PlaceholderTextProperty instead.", false)]
|
||||||
AvaloniaProperty.Register<TextBox, bool>(nameof(UseFloatingWatermark));
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<string?> WatermarkProperty = PlaceholderTextProperty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="UseFloatingPlaceholder"/> property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly StyledProperty<bool> UseFloatingPlaceholderProperty =
|
||||||
|
AvaloniaProperty.Register<TextBox, bool>(nameof(UseFloatingPlaceholder));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="UseFloatingWatermark"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use UseFloatingPlaceholderProperty instead.", false)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<bool> UseFloatingWatermarkProperty = UseFloatingPlaceholderProperty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="PlaceholderForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly StyledProperty<IBrush?> PlaceholderForegroundProperty =
|
||||||
|
AvaloniaProperty.Register<TextBox, IBrush?>(nameof(PlaceholderForeground));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="WatermarkForeground"/> property.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForegroundProperty instead.", false)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1022",
|
||||||
|
Justification = "Obsolete property alias for backward compatibility.")]
|
||||||
|
public static readonly StyledProperty<IBrush?> WatermarkForegroundProperty = PlaceholderForegroundProperty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="NewLine"/> property
|
/// Defines the <see cref="NewLine"/> property
|
||||||
@@ -394,8 +424,8 @@ namespace Avalonia.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ClearSelectionOnLostFocus
|
public bool ClearSelectionOnLostFocus
|
||||||
{
|
{
|
||||||
get=> GetValue(ClearSelectionOnLostFocusProperty);
|
get => GetValue(ClearSelectionOnLostFocusProperty);
|
||||||
set=> SetValue(ClearSelectionOnLostFocusProperty, value);
|
set => SetValue(ClearSelectionOnLostFocusProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -408,7 +438,7 @@ namespace Avalonia.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value that determins whether the TextBox allows and displays tabs
|
/// Gets or sets a value that determines whether the TextBox allows and displays tabs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AcceptsTab
|
public bool AcceptsTab
|
||||||
{
|
{
|
||||||
@@ -516,7 +546,7 @@ namespace Avalonia.Controls
|
|||||||
/// Gets or sets the end position of the text selected in the TextBox
|
/// Gets or sets the end position of the text selected in the TextBox
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// When the SelectionEnd is equal to <see cref="SelectionStart"/>, there is no
|
/// When the SelectionEnd is equal to <see cref="SelectionStart"/>, there is no
|
||||||
/// selected text and it marks the caret position
|
/// selected text and it marks the caret position
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int SelectionEnd
|
public int SelectionEnd
|
||||||
@@ -665,20 +695,67 @@ namespace Avalonia.Controls
|
|||||||
/// Gets or sets the placeholder or descriptive text that is displayed even if the <see cref="Text"/>
|
/// Gets or sets the placeholder or descriptive text that is displayed even if the <see cref="Text"/>
|
||||||
/// property is not yet set.
|
/// property is not yet set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Watermark
|
public string? PlaceholderText
|
||||||
{
|
{
|
||||||
get => GetValue(WatermarkProperty);
|
get => GetValue(PlaceholderTextProperty);
|
||||||
set => SetValue(WatermarkProperty, value);
|
set => SetValue(PlaceholderTextProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the <see cref="Watermark"/> will still be shown above the
|
/// Gets or sets the placeholder or descriptive text that is displayed even if the <see cref="Text"/>
|
||||||
|
/// property is not yet set.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderText instead.", false)]
|
||||||
|
public string? Watermark
|
||||||
|
{
|
||||||
|
get => PlaceholderText;
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the <see cref="PlaceholderText"/> will still be shown above the
|
||||||
/// <see cref="Text"/> even after a text value is set.
|
/// <see cref="Text"/> even after a text value is set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public bool UseFloatingPlaceholder
|
||||||
|
{
|
||||||
|
get => GetValue(UseFloatingPlaceholderProperty);
|
||||||
|
set => SetValue(UseFloatingPlaceholderProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the <see cref="PlaceholderText"/> will still be shown above the
|
||||||
|
/// <see cref="Text"/> even after a text value is set.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use UseFloatingPlaceholder instead.", false)]
|
||||||
public bool UseFloatingWatermark
|
public bool UseFloatingWatermark
|
||||||
{
|
{
|
||||||
get => GetValue(UseFloatingWatermarkProperty);
|
get => UseFloatingPlaceholder;
|
||||||
set => SetValue(UseFloatingWatermarkProperty, value);
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => UseFloatingPlaceholder = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush used for the foreground color of the placeholder text.
|
||||||
|
/// </summary>
|
||||||
|
public IBrush? PlaceholderForeground
|
||||||
|
{
|
||||||
|
get => GetValue(PlaceholderForegroundProperty);
|
||||||
|
set => SetValue(PlaceholderForegroundProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the brush used for the foreground color of the placeholder text.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use PlaceholderForeground instead.", false)]
|
||||||
|
public IBrush? WatermarkForeground
|
||||||
|
{
|
||||||
|
get => PlaceholderForeground;
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
|
||||||
|
Justification = "Obsolete property setter for backward compatibility.")]
|
||||||
|
set => PlaceholderForeground = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1018,7 +1095,7 @@ namespace Avalonia.Controls
|
|||||||
if(_presenter != null)
|
if(_presenter != null)
|
||||||
{
|
{
|
||||||
_presenter.ShowSelectionHighlight = true;
|
_presenter.ShowSelectionHighlight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when navigating to a textbox via the tab key, select all text if
|
// when navigating to a textbox via the tab key, select all text if
|
||||||
// 1) this textbox is *not* a multiline textbox
|
// 1) this textbox is *not* a multiline textbox
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:generic="using:System.Collections.Generic"
|
xmlns:generic="using:System.Collections.Generic"
|
||||||
x:ClassModifier="internal">
|
x:ClassModifier="internal">
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</AutoCompleteBox>
|
</AutoCompleteBox>
|
||||||
</Border>
|
</Border>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type AutoCompleteBox}" TargetType="AutoCompleteBox">
|
<ControlTheme x:Key="{x:Type AutoCompleteBox}" TargetType="AutoCompleteBox">
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
<Setter Property="VerticalAlignment" Value="Top" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
||||||
@@ -34,7 +34,8 @@
|
|||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<Grid Name="PART_LayoutRoot">
|
<Grid Name="PART_LayoutRoot">
|
||||||
<TextBox Name="PART_TextBox"
|
<TextBox Name="PART_TextBox"
|
||||||
Watermark="{TemplateBinding Watermark}"
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
|
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||||
Width="{TemplateBinding Width}"
|
Width="{TemplateBinding Width}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
@@ -50,9 +51,9 @@
|
|||||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||||
InnerRightContent="{TemplateBinding InnerRightContent}"
|
InnerRightContent="{TemplateBinding InnerRightContent}"
|
||||||
/>
|
/>
|
||||||
<Popup Name="PART_Popup"
|
<Popup Name="PART_Popup"
|
||||||
WindowManagerAddShadowHint="False"
|
WindowManagerAddShadowHint="False"
|
||||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementTarget="{TemplateBinding}">
|
PlacementTarget="{TemplateBinding}">
|
||||||
@@ -74,5 +75,5 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:sys="using:System"
|
xmlns:sys="using:System"
|
||||||
x:ClassModifier="internal">
|
x:ClassModifier="internal">
|
||||||
@@ -92,8 +92,9 @@
|
|||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
Margin="{TemplateBinding BorderThickness}"
|
Margin="{TemplateBinding BorderThickness}"
|
||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
Watermark="{TemplateBinding Watermark}"
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||||
|
UseFloatingPlaceholder="{TemplateBinding UseFloatingPlaceholder}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
@@ -112,7 +113,7 @@
|
|||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="BorderBrush" Value="Transparent" />
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ TextBlock#PART_Watermark, ^ TextBlock#PART_FloatingWatermark">
|
<Style Selector="^ /template/ TextBlock#PART_Placeholder, ^ TextBlock#PART_FloatingPlaceholder">
|
||||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource CalendarDatePickerTextForegroundDisabled}" />
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource CalendarDatePickerTextForegroundDisabled}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:sys="using:System"
|
xmlns:sys="using:System"
|
||||||
x:ClassModifier="internal">
|
x:ClassModifier="internal">
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<ComboBoxItem>Item 1</ComboBoxItem>
|
<ComboBoxItem>Item 1</ComboBoxItem>
|
||||||
<ComboBoxItem>Item 2</ComboBoxItem>
|
<ComboBoxItem>Item 2</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<ComboBox PlaceholderText="Error">
|
<ComboBox PlaceholderText="Error">
|
||||||
<DataValidationErrors.Error>
|
<DataValidationErrors.Error>
|
||||||
<sys:Exception>
|
<sys:Exception>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Text="{TemplateBinding Text, Mode=TwoWay}"
|
Text="{TemplateBinding Text, Mode=TwoWay}"
|
||||||
Watermark="{TemplateBinding PlaceholderText}"
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
IsVisible="{TemplateBinding IsEditable}">
|
IsVisible="{TemplateBinding IsEditable}">
|
||||||
<TextBox.Resources>
|
<TextBox.Resources>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:dialogs="using:Avalonia.Dialogs"
|
xmlns:dialogs="using:Avalonia.Dialogs"
|
||||||
xmlns:internal="using:Avalonia.Dialogs.Internal"
|
xmlns:internal="using:Avalonia.Dialogs.Internal"
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
<Path Data="M 0 7 L 7 0 L 14 7 M 7 0 L 7 16" Stroke="{CompiledBinding $parent[Button].Foreground}" StrokeThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,-1"/>
|
<Path Data="M 0 7 L 7 0 L 14 7 M 7 0 L 7 16" Stroke="{CompiledBinding $parent[Button].Foreground}" StrokeThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,-1"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Command="{Binding Refresh}" DockPanel.Dock="Right" Margin="8,0,0,0">
|
<Button Command="{Binding Refresh}" DockPanel.Dock="Right" Margin="8,0,0,0">
|
||||||
<Path Data="M18.62 3.32c.39 0 .7.29.76.66v3c0 .39-.28.7-.66.76h-3a.77.77 0 0 1-.1-1.52h1.08a7.42 7.42 0 1 0 2.65 4.37.77.77 0 1 1 1.5-.3 8.94 8.94 0 1 1-3-5.12V4.09c0-.43.35-.77.77-.77Z"
|
<Path Data="M18.62 3.32c.39 0 .7.29.76.66v3c0 .39-.28.7-.66.76h-3a.77.77 0 0 1-.1-1.52h1.08a7.42 7.42 0 1 0 2.65 4.37.77.77 0 1 1 1.5-.3 8.94 8.94 0 1 1-3-5.12V4.09c0-.43.35-.77.77-.77Z"
|
||||||
Fill="{CompiledBinding $parent[Button].Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-2,-4,0,0"/>
|
Fill="{CompiledBinding $parent[Button].Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-2,-4,0,0"/>
|
||||||
</Button>
|
</Button>
|
||||||
<TextBox x:Name="Location" Text="{Binding Location}">
|
<TextBox x:Name="Location" Text="{Binding Location}">
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
IsVisible="{Binding ShowFilters}"
|
IsVisible="{Binding ShowFilters}"
|
||||||
ItemsSource="{Binding Filters}"
|
ItemsSource="{Binding Filters}"
|
||||||
SelectedItem="{Binding SelectedFilter}" />
|
SelectedItem="{Binding SelectedFilter}" />
|
||||||
<TextBox Text="{Binding FileName}" Watermark="{DynamicResource StringManagedFileChooserFileNameWatermark}" IsVisible="{Binding !SelectingFolder}" />
|
<TextBox Text="{Binding FileName}" PlaceholderText="{DynamicResource StringManagedFileChooserFileNamePlaceholder}" IsVisible="{Binding !SelectingFolder}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<CheckBox IsChecked="{Binding ShowHiddenFiles}" Content="{DynamicResource StringManagedFileChooserShowHiddenFilesText}" DockPanel.Dock="Left"/>
|
<CheckBox IsChecked="{Binding ShowHiddenFiles}" Content="{DynamicResource StringManagedFileChooserShowHiddenFilesText}" DockPanel.Dock="Left"/>
|
||||||
<UniformGrid x:Name="Finalize" HorizontalAlignment="Right" Rows="1">
|
<UniformGrid x:Name="Finalize" HorizontalAlignment="Right" Rows="1">
|
||||||
@@ -344,7 +344,7 @@
|
|||||||
<Setter Property="Margin" Value="4,0,0,0"/>
|
<Setter Property="Margin" Value="4,0,0,0"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooserOverwritePrompt}" TargetType="dialogs:ManagedFileChooserOverwritePrompt">
|
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooserOverwritePrompt}" TargetType="dialogs:ManagedFileChooserOverwritePrompt">
|
||||||
<Setter Property="MinWidth" Value="270" />
|
<Setter Property="MinWidth" Value="270" />
|
||||||
<Setter Property="MaxWidth" Value="400" />
|
<Setter Property="MaxWidth" Value="400" />
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
||||||
x:ClassModifier="internal">
|
x:ClassModifier="internal">
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<Border Padding="20">
|
<Border Padding="20">
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
|
<NumericUpDown Minimum="0"
|
||||||
|
Maximum="10"
|
||||||
|
Increment="0.5"
|
||||||
|
PlaceholderText="Enter text" />
|
||||||
<NumericUpDown Minimum="0"
|
<NumericUpDown Minimum="0"
|
||||||
Maximum="10"
|
Maximum="10"
|
||||||
Increment="0.5"
|
Increment="0.5"
|
||||||
Watermark="Enter text" />
|
VerticalContentAlignment="Center"
|
||||||
<NumericUpDown Minimum="0"
|
HorizontalContentAlignment="Center"
|
||||||
Maximum="10"
|
ButtonSpinnerLocation="Left"
|
||||||
Increment="0.5"
|
PlaceholderText="Enter text" />
|
||||||
VerticalContentAlignment="Center"
|
|
||||||
HorizontalContentAlignment="Center"
|
|
||||||
ButtonSpinnerLocation="Left"
|
|
||||||
Watermark="Enter text" />
|
|
||||||
<NumericUpDown ButtonSpinnerLocation="Left">
|
<NumericUpDown ButtonSpinnerLocation="Left">
|
||||||
<NumericUpDown.InnerLeftContent>
|
<NumericUpDown.InnerLeftContent>
|
||||||
<TextBlock Text="m"
|
<TextBlock Text="m"
|
||||||
@@ -81,7 +81,8 @@
|
|||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
MinWidth="0"
|
MinWidth="0"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Watermark="{TemplateBinding Watermark}"
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
|
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
<TextBox Classes="clearButton">Clear</TextBox>
|
<TextBox Classes="clearButton">Clear</TextBox>
|
||||||
<TextBox PasswordChar="*" Classes="revealPasswordButton">Reveal Password</TextBox>
|
<TextBox PasswordChar="*" Classes="revealPasswordButton">Reveal Password</TextBox>
|
||||||
<TextBox PasswordChar="*" Classes="revealPasswordButton" RevealPassword="True">Password Revealed</TextBox>
|
<TextBox PasswordChar="*" Classes="revealPasswordButton" RevealPassword="True">Password Revealed</TextBox>
|
||||||
<TextBox Watermark="Watermark"/>
|
<TextBox PlaceholderText="Placeholder"/>
|
||||||
<TextBox Watermark="Floating Watermark" UseFloatingWatermark="True"/>
|
<TextBox PlaceholderText="Floating Placeholder" UseFloatingPlaceholder="True"/>
|
||||||
<TextBox Watermark="Floating Watermark" UseFloatingWatermark="True">Content</TextBox>
|
<TextBox PlaceholderText="Floating Placeholder" UseFloatingPlaceholder="True">Content</TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<StreamGeometry x:Key="TextBoxClearButtonData">M 11.416016,10 20,1.4160156 18.583984,0 10,8.5839846 1.4160156,0 0,1.4160156 8.5839844,10 0,18.583985 1.4160156,20 10,11.416015 18.583984,20 20,18.583985 Z</StreamGeometry>
|
<StreamGeometry x:Key="TextBoxClearButtonData">M 11.416016,10 20,1.4160156 18.583984,0 10,8.5839846 1.4160156,0 0,1.4160156 8.5839844,10 0,18.583985 1.4160156,20 10,11.416015 18.583984,20 20,18.583985 Z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="PasswordBoxRevealButtonData">m10.051 7.0032c2.215 0 4.0105 1.7901 4.0105 3.9984s-1.7956 3.9984-4.0105 3.9984c-2.215 0-4.0105-1.7901-4.0105-3.9984s1.7956-3.9984 4.0105-3.9984zm0 1.4994c-1.3844 0-2.5066 1.1188-2.5066 2.499s1.1222 2.499 2.5066 2.499 2.5066-1.1188 2.5066-2.499-1.1222-2.499-2.5066-2.499zm0-5.0026c4.6257 0 8.6188 3.1487 9.7267 7.5613 0.10085 0.40165-0.14399 0.80877-0.54686 0.90931-0.40288 0.10054-0.81122-0.14355-0.91208-0.54521-0.94136-3.7492-4.3361-6.4261-8.2678-6.4261-3.9334 0-7.3292 2.6792-8.2689 6.4306-0.10063 0.40171-0.50884 0.64603-0.91177 0.54571s-0.648-0.5073-0.54737-0.90901c1.106-4.4152 5.1003-7.5667 9.728-7.5667z</StreamGeometry>
|
<StreamGeometry x:Key="PasswordBoxRevealButtonData">m10.051 7.0032c2.215 0 4.0105 1.7901 4.0105 3.9984s-1.7956 3.9984-4.0105 3.9984c-2.215 0-4.0105-1.7901-4.0105-3.9984s1.7956-3.9984 4.0105-3.9984zm0 1.4994c-1.3844 0-2.5066 1.1188-2.5066 2.499s1.1222 2.499 2.5066 2.499 2.5066-1.1188 2.5066-2.499-1.1222-2.499-2.5066-2.499zm0-5.0026c4.6257 0 8.6188 3.1487 9.7267 7.5613 0.10085 0.40165-0.14399 0.80877-0.54686 0.90931-0.40288 0.10054-0.81122-0.14355-0.91208-0.54521-0.94136-3.7492-4.3361-6.4261-8.2678-6.4261-3.9334 0-7.3292 2.6792-8.2689 6.4306-0.10063 0.40171-0.50884 0.64603-0.91177 0.54571s-0.648-0.5073-0.54737-0.90901c1.106-4.4152 5.1003-7.5667 9.728-7.5667z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="PasswordBoxHideButtonData">m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z</StreamGeometry>
|
<StreamGeometry x:Key="PasswordBoxHideButtonData">m0.21967 0.21965c-0.26627 0.26627-0.29047 0.68293-0.07262 0.97654l0.07262 0.08412 4.0346 4.0346c-1.922 1.3495-3.3585 3.365-3.9554 5.7495-0.10058 0.4018 0.14362 0.8091 0.54543 0.9097 0.40182 0.1005 0.80909-0.1436 0.90968-0.5455 0.52947-2.1151 1.8371-3.8891 3.5802-5.0341l1.8096 1.8098c-0.70751 0.7215-1.1438 1.71-1.1438 2.8003 0 2.2092 1.7909 4 4 4 1.0904 0 2.0788-0.4363 2.8004-1.1438l5.9193 5.9195c0.2929 0.2929 0.7677 0.2929 1.0606 0 0.2663-0.2662 0.2905-0.6829 0.0726-0.9765l-0.0726-0.0841-6.1135-6.1142 0.0012-0.0015-1.2001-1.1979-2.8699-2.8693 2e-3 -8e-4 -2.8812-2.8782 0.0012-0.0018-1.1333-1.1305-4.3064-4.3058c-0.29289-0.29289-0.76777-0.29289-1.0607 0zm7.9844 9.0458 3.5351 3.5351c-0.45 0.4358-1.0633 0.704-1.7392 0.704-1.3807 0-2.5-1.1193-2.5-2.5 0-0.6759 0.26824-1.2892 0.7041-1.7391zm1.7959-5.7655c-1.0003 0-1.9709 0.14807-2.8889 0.425l1.237 1.2362c0.5358-0.10587 1.0883-0.16119 1.6519-0.16119 3.9231 0 7.3099 2.6803 8.2471 6.4332 0.1004 0.4018 0.5075 0.6462 0.9094 0.5459 0.4019-0.1004 0.6463-0.5075 0.5459-0.9094-1.103-4.417-5.0869-7.5697-9.7024-7.5697zm0.1947 3.5093 3.8013 3.8007c-0.1018-2.0569-1.7488-3.7024-3.8013-3.8007z</StreamGeometry>
|
||||||
|
|
||||||
<MenuFlyout x:Key="DefaultTextBoxContextFlyout" ShowMode="{OnFormFactor Desktop=Standard, Mobile=Transient}">
|
<MenuFlyout x:Key="DefaultTextBoxContextFlyout" ShowMode="{OnFormFactor Desktop=Standard, Mobile=Transient}">
|
||||||
<MenuItem Header="{DynamicResource StringTextFlyoutCutText}" Command="{Binding $parent[TextBox].Cut}" IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" />
|
<MenuItem Header="{DynamicResource StringTextFlyoutCutText}" Command="{Binding $parent[TextBox].Cut}" IsEnabled="{Binding $parent[TextBox].CanCut}" InputGesture="{x:Static TextBox.CutGesture}" />
|
||||||
<MenuItem Header="{DynamicResource StringTextFlyoutCopyText}" Command="{Binding $parent[TextBox].Copy}" IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}"/>
|
<MenuItem Header="{DynamicResource StringTextFlyoutCopyText}" Command="{Binding $parent[TextBox].Copy}" IsEnabled="{Binding $parent[TextBox].CanCopy}" InputGesture="{x:Static TextBox.CopyGesture}"/>
|
||||||
@@ -99,6 +99,7 @@
|
|||||||
<Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
<Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
|
||||||
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
|
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
|
||||||
|
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextControlPlaceholderForeground}" />
|
||||||
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" />
|
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
|
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
|
||||||
@@ -132,11 +133,12 @@
|
|||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.ColumnSpan="1"
|
Grid.ColumnSpan="1"
|
||||||
Margin="{TemplateBinding Padding}">
|
Margin="{TemplateBinding Padding}">
|
||||||
<TextBlock Name="PART_FloatingWatermark"
|
<TextBlock Name="PART_FloatingPlaceholder"
|
||||||
Foreground="{DynamicResource SystemAccentColor}"
|
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Text="{TemplateBinding Watermark}"
|
Text="{TemplateBinding PlaceholderText}"
|
||||||
DockPanel.Dock="Top" />
|
DockPanel.Dock="Top" />
|
||||||
|
|
||||||
<ScrollViewer Name="PART_ScrollViewer"
|
<ScrollViewer Name="PART_ScrollViewer"
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
|
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
|
||||||
@@ -144,9 +146,10 @@
|
|||||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
||||||
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}">
|
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}">
|
||||||
<Panel>
|
<Panel>
|
||||||
<TextBlock Name="PART_Watermark"
|
<TextBlock Name="PART_Placeholder"
|
||||||
|
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||||
Opacity="{DynamicResource TextControlPlaceholderOpacity}"
|
Opacity="{DynamicResource TextControlPlaceholderOpacity}"
|
||||||
Text="{TemplateBinding Watermark}"
|
Text="{TemplateBinding PlaceholderText}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}"
|
TextWrapping="{TemplateBinding TextWrapping}"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
@@ -158,6 +161,7 @@
|
|||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</TextBlock.IsVisible>
|
</TextBlock.IsVisible>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<TextPresenter Name="PART_TextPresenter"
|
<TextPresenter Name="PART_TextPresenter"
|
||||||
Text="{TemplateBinding Text, Mode=TwoWay}"
|
Text="{TemplateBinding Text, Mode=TwoWay}"
|
||||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||||
@@ -203,9 +207,6 @@
|
|||||||
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^ /template/ TextBlock#PART_Watermark, ^ /template/ TextBlock#PART_FloatingWatermark">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundDisabled}" />
|
|
||||||
</Style>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- PointerOver State-->
|
<!-- PointerOver State-->
|
||||||
@@ -217,19 +218,12 @@
|
|||||||
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
|
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^ /template/ TextBlock#PART_Watermark">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundPointerOver}" />
|
|
||||||
</Style>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Focused State -->
|
<!-- Focused State -->
|
||||||
<Style Selector="^:focus">
|
<Style Selector="^:focus">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" />
|
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" />
|
||||||
|
|
||||||
<Style Selector="^ /template/ TextBlock#PART_Watermark">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundFocused}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="^ /template/ Border#PART_BorderElement">
|
<Style Selector="^ /template/ Border#PART_BorderElement">
|
||||||
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}"/>
|
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}"/>
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}"/>
|
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}"/>
|
||||||
@@ -241,14 +235,15 @@
|
|||||||
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlErrorTextForegroundBrush}"/>
|
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlErrorTextForegroundBrush}"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^ /template/ TextBlock#PART_FloatingWatermark">
|
<Style Selector="^ /template/ TextBlock#PART_FloatingPlaceholder">
|
||||||
<Setter Property="Cursor" Value="IBeam"/>
|
<Setter Property="Cursor" Value="IBeam"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^[UseFloatingWatermark=true]:not(:empty) /template/ TextBlock#PART_FloatingWatermark">
|
<Style Selector="^[UseFloatingPlaceholder=true]:not(:empty) /template/ TextBlock#PART_FloatingPlaceholder">
|
||||||
<Setter Property="IsVisible" Value="True" />
|
<Setter Property="IsVisible" Value="True" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
<Style Selector="^.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
|
<Style Selector="^.revealPasswordButton[AcceptsReturn=False][IsReadOnly=False]:not(TextBox:empty)">
|
||||||
<Setter Property="InnerRightContent">
|
<Setter Property="InnerRightContent">
|
||||||
<Template>
|
<Template>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<x:String x:Key="StringTextFlyoutCopyText">Copy</x:String>
|
<x:String x:Key="StringTextFlyoutCopyText">Copy</x:String>
|
||||||
<x:String x:Key="StringTextFlyoutPasteText">Paste</x:String>
|
<x:String x:Key="StringTextFlyoutPasteText">Paste</x:String>
|
||||||
<!-- ManagedFileChooser -->
|
<!-- ManagedFileChooser -->
|
||||||
<x:String x:Key="StringManagedFileChooserFileNameWatermark">File name</x:String>
|
<x:String x:Key="StringManagedFileChooserFileNamePlaceholder">File name</x:String>
|
||||||
<x:String x:Key="StringManagedFileChooserShowHiddenFilesText">Show hidden files</x:String>
|
<x:String x:Key="StringManagedFileChooserShowHiddenFilesText">Show hidden files</x:String>
|
||||||
<x:String x:Key="StringManagedFileChooserOkText">OK</x:String>
|
<x:String x:Key="StringManagedFileChooserOkText">OK</x:String>
|
||||||
<x:String x:Key="StringManagedFileChooserCancelText">Cancel</x:String>
|
<x:String x:Key="StringManagedFileChooserCancelText">Cancel</x:String>
|
||||||
|
|||||||
@@ -19,8 +19,9 @@
|
|||||||
CaretIndex="{TemplateBinding CaretIndex, Mode=TwoWay}"
|
CaretIndex="{TemplateBinding CaretIndex, Mode=TwoWay}"
|
||||||
ClearSelectionOnLostFocus="{TemplateBinding ClearSelectionOnLostFocus}"
|
ClearSelectionOnLostFocus="{TemplateBinding ClearSelectionOnLostFocus}"
|
||||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||||
Watermark="{TemplateBinding Watermark}"
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
MaxLength="{TemplateBinding MaxLength}"
|
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||||
|
MaxLength="{TemplateBinding MaxLength}"
|
||||||
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
InnerLeftContent="{TemplateBinding InnerLeftContent}"
|
||||||
InnerRightContent="{TemplateBinding InnerRightContent}"
|
InnerRightContent="{TemplateBinding InnerRightContent}"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -101,8 +101,9 @@
|
|||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
UseFloatingPlaceholder="{TemplateBinding UseFloatingPlaceholder}"
|
||||||
Watermark="{TemplateBinding Watermark}" />
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
|
PlaceholderForeground="{TemplateBinding PlaceholderForeground}" />
|
||||||
|
|
||||||
<Button Name="PART_Button"
|
<Button Name="PART_Button"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
<TextBox DockPanel.Dock="Bottom"
|
<TextBox DockPanel.Dock="Bottom"
|
||||||
IsVisible="{Binding !SelectingFolder}"
|
IsVisible="{Binding !SelectingFolder}"
|
||||||
Text="{Binding FileName}"
|
Text="{Binding FileName}"
|
||||||
Watermark="{DynamicResource StringManagedFileChooserFileNameWatermark}" />
|
PlaceholderText="{DynamicResource StringManagedFileChooserFileNamePlaceholder}" />
|
||||||
|
|
||||||
<ListBox x:Name="PART_QuickLinks"
|
<ListBox x:Name="PART_QuickLinks"
|
||||||
MaxWidth="200"
|
MaxWidth="200"
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
<Binding Path ="FileName" RelativeSource="{RelativeSource TemplatedParent}" />
|
<Binding Path ="FileName" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</TextBlock.Text>
|
</TextBlock.Text>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<StackPanel HorizontalAlignment="Right"
|
<StackPanel HorizontalAlignment="Right"
|
||||||
Spacing="10"
|
Spacing="10"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
|
|||||||
@@ -37,7 +37,8 @@
|
|||||||
Text="{TemplateBinding Text}"
|
Text="{TemplateBinding Text}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="NoWrap"
|
TextWrapping="NoWrap"
|
||||||
Watermark="{TemplateBinding Watermark}"
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
|
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||||
InnerLeftContent="{Binding InnerLeftContent, RelativeSource={RelativeSource TemplatedParent}}"
|
InnerLeftContent="{Binding InnerLeftContent, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
InnerRightContent="{Binding InnerRightContent, RelativeSource={RelativeSource TemplatedParent}}"/>
|
InnerRightContent="{Binding InnerRightContent, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
</ButtonSpinner>
|
</ButtonSpinner>
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
|
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}" />
|
||||||
|
<Setter Property="PlaceholderForeground" Value="{DynamicResource ThemeForegroundLowBrush}" />
|
||||||
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
|
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
|
||||||
<Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
|
<Setter Property="SelectionBrush" Value="{DynamicResource HighlightBrush}" />
|
||||||
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}" />
|
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource HighlightForegroundBrush}" />
|
||||||
@@ -102,14 +103,14 @@
|
|||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||||
|
|
||||||
<TextBlock Name="floatingWatermark"
|
<TextBlock Name="floatingPlaceholder"
|
||||||
DockPanel.Dock="Top"
|
DockPanel.Dock="Top"
|
||||||
FontSize="{DynamicResource FontSizeSmall}"
|
FontSize="{DynamicResource FontSizeSmall}"
|
||||||
Foreground="{DynamicResource ThemeAccentBrush}"
|
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||||
Text="{TemplateBinding Watermark}">
|
Text="{TemplateBinding PlaceholderText}">
|
||||||
<TextBlock.IsVisible>
|
<TextBlock.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding Path="UseFloatingWatermark"
|
<Binding Path="UseFloatingPlaceholder"
|
||||||
RelativeSource="{RelativeSource TemplatedParent}" />
|
RelativeSource="{RelativeSource TemplatedParent}" />
|
||||||
<Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
|
<Binding Converter="{x:Static StringConverters.IsNotNullOrEmpty}"
|
||||||
Path="Text"
|
Path="Text"
|
||||||
@@ -133,11 +134,12 @@
|
|||||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
||||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||||
<Panel>
|
<Panel>
|
||||||
<TextBlock Name="watermark"
|
<TextBlock Name="placeholder"
|
||||||
|
Foreground="{TemplateBinding PlaceholderForeground}"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Opacity="{DynamicResource TextControlPlaceholderOpacity}"
|
Opacity="{DynamicResource TextControlPlaceholderOpacity}"
|
||||||
Text="{TemplateBinding Watermark}"
|
Text="{TemplateBinding PlaceholderText}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}">
|
TextWrapping="{TemplateBinding TextWrapping}">
|
||||||
<TextBlock.IsVisible>
|
<TextBlock.IsVisible>
|
||||||
@@ -194,7 +196,7 @@
|
|||||||
<Style Selector="^:disabled /template/ Border#border">
|
<Style Selector="^:disabled /template/ Border#border">
|
||||||
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
|
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ TextBlock#floatingWatermark">
|
<Style Selector="^ /template/ TextBlock#floatingPlaceholder">
|
||||||
<Setter Property="Cursor" Value="IBeam"/>
|
<Setter Property="Cursor" Value="IBeam"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
@@ -203,7 +205,7 @@
|
|||||||
<Template>
|
<Template>
|
||||||
<Button Command="{Binding $parent[TextBox].Clear}"
|
<Button Command="{Binding $parent[TextBox].Clear}"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
Theme="{StaticResource SimpleTextBoxClearButtonTheme}"
|
Theme="{StaticResource SimpleTextBoxClearButtonTheme}"
|
||||||
ClipToBounds="True" />
|
ClipToBounds="True" />
|
||||||
</Template>
|
</Template>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal(control.Text, control.ItemSelector(input, selectedItem));
|
Assert.Equal(control.Text, control.ItemSelector(input, selectedItem));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Text_Validation()
|
public void Text_Validation()
|
||||||
{
|
{
|
||||||
@@ -421,7 +421,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal([exception], DataValidationErrors.GetErrors(control));
|
Assert.Equal([exception], DataValidationErrors.GetErrors(control));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Text_Validation_TextBox_Errors_Binding()
|
public void Text_Validation_TextBox_Errors_Binding()
|
||||||
{
|
{
|
||||||
@@ -430,20 +430,20 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
// simulate the TemplateBinding that would be used within the AutoCompleteBox control theme for the inner PART_TextBox
|
// simulate the TemplateBinding that would be used within the AutoCompleteBox control theme for the inner PART_TextBox
|
||||||
// DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
// DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||||
textbox.Bind(DataValidationErrors.ErrorsProperty, control.GetBindingObservable(DataValidationErrors.ErrorsProperty));
|
textbox.Bind(DataValidationErrors.ErrorsProperty, control.GetBindingObservable(DataValidationErrors.ErrorsProperty));
|
||||||
|
|
||||||
var exception = new InvalidCastException("failed validation");
|
var exception = new InvalidCastException("failed validation");
|
||||||
var textObservable = new BehaviorSubject<BindingNotification>(new BindingNotification(exception, BindingErrorType.DataValidationError));
|
var textObservable = new BehaviorSubject<BindingNotification>(new BindingNotification(exception, BindingErrorType.DataValidationError));
|
||||||
control.Bind(AutoCompleteBox.TextProperty, textObservable);
|
control.Bind(AutoCompleteBox.TextProperty, textObservable);
|
||||||
Dispatcher.UIThread.RunJobs();
|
Dispatcher.UIThread.RunJobs();
|
||||||
|
|
||||||
Assert.True(DataValidationErrors.GetHasErrors(control));
|
Assert.True(DataValidationErrors.GetHasErrors(control));
|
||||||
Assert.Equal([exception], DataValidationErrors.GetErrors(control));
|
Assert.Equal([exception], DataValidationErrors.GetErrors(control));
|
||||||
|
|
||||||
Assert.True(DataValidationErrors.GetHasErrors(textbox));
|
Assert.True(DataValidationErrors.GetHasErrors(textbox));
|
||||||
Assert.Equal([exception], DataValidationErrors.GetErrors(textbox));
|
Assert.Equal([exception], DataValidationErrors.GetErrors(textbox));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SelectedItem_Validation()
|
public void SelectedItem_Validation()
|
||||||
{
|
{
|
||||||
@@ -583,7 +583,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves a defined predicate filter through a new AutoCompleteBox
|
/// Retrieves a defined predicate filter through a new AutoCompleteBox
|
||||||
/// control instance.
|
/// control instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mode">The FilterMode of interest.</param>
|
/// <param name="mode">The FilterMode of interest.</param>
|
||||||
@@ -1283,5 +1283,18 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
IsOpen = true;
|
IsOpen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PlaceholderForeground_Can_Be_Set()
|
||||||
|
{
|
||||||
|
using (UnitTestApplication.Start(TestServices.StyledWindow))
|
||||||
|
{
|
||||||
|
var control = CreateControl();
|
||||||
|
control.PlaceholderText = "Search...";
|
||||||
|
control.PlaceholderForeground = Media.Brushes.Green;
|
||||||
|
|
||||||
|
Assert.Equal(Media.Brushes.Green, control.PlaceholderForeground);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
{
|
{
|
||||||
return new FuncControlTemplate<CalendarDatePicker>((control, scope) =>
|
return new FuncControlTemplate<CalendarDatePicker>((control, scope) =>
|
||||||
{
|
{
|
||||||
var textBox =
|
var textBox =
|
||||||
new TextBox
|
new TextBox
|
||||||
{
|
{
|
||||||
Name = "PART_TextBox"
|
Name = "PART_TextBox"
|
||||||
@@ -130,7 +130,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
var calendar =
|
var calendar =
|
||||||
new Calendar
|
new Calendar
|
||||||
{
|
{
|
||||||
Name = "PART_Calendar",
|
Name = "PART_Calendar",
|
||||||
[!Calendar.SelectedDateProperty] = control[!CalendarDatePicker.SelectedDateProperty],
|
[!Calendar.SelectedDateProperty] = control[!CalendarDatePicker.SelectedDateProperty],
|
||||||
[!Calendar.DisplayDateProperty] = control[!CalendarDatePicker.DisplayDateProperty],
|
[!Calendar.DisplayDateProperty] = control[!CalendarDatePicker.DisplayDateProperty],
|
||||||
[!Calendar.DisplayDateStartProperty] = control[!CalendarDatePicker.DisplayDateStartProperty],
|
[!Calendar.DisplayDateStartProperty] = control[!CalendarDatePicker.DisplayDateStartProperty],
|
||||||
@@ -179,5 +179,18 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PlaceholderForeground_Can_Be_Set()
|
||||||
|
{
|
||||||
|
using (UnitTestApplication.Start(Services))
|
||||||
|
{
|
||||||
|
var control = CreateControl();
|
||||||
|
control.PlaceholderText = "Select date";
|
||||||
|
control.PlaceholderForeground = Media.Brushes.Purple;
|
||||||
|
|
||||||
|
Assert.Equal(Media.Brushes.Purple, control.PlaceholderForeground);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -58,7 +58,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
var spinner = GetSpinner(control);
|
var spinner = GetSpinner(control);
|
||||||
|
|
||||||
spinner.RaiseEvent(new SpinEventArgs(Spinner.SpinEvent, direction));
|
spinner.RaiseEvent(new SpinEventArgs(Spinner.SpinEvent, direction));
|
||||||
|
|
||||||
Assert.Equal(control.Value, expected);
|
Assert.Equal(control.Value, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,16 +105,16 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
// if min and max are not defined and value was null, 0 should be ne new value after spin
|
// if min and max are not defined and value was null, 0 should be ne new value after spin
|
||||||
yield return [decimal.MinValue, decimal.MaxValue, null, SpinDirection.Decrease, 0m];
|
yield return [decimal.MinValue, decimal.MaxValue, null, SpinDirection.Decrease, 0m];
|
||||||
yield return [decimal.MinValue, decimal.MaxValue, null, SpinDirection.Increase, 0m];
|
yield return [decimal.MinValue, decimal.MaxValue, null, SpinDirection.Increase, 0m];
|
||||||
|
|
||||||
// if no value was defined, but Min or Max are defined, use these as the new value
|
// if no value was defined, but Min or Max are defined, use these as the new value
|
||||||
yield return [-400m, -200m, null, SpinDirection.Decrease, -200m];
|
yield return [-400m, -200m, null, SpinDirection.Decrease, -200m];
|
||||||
yield return [200m, 400m, null, SpinDirection.Increase, 200m];
|
yield return [200m, 400m, null, SpinDirection.Increase, 200m];
|
||||||
|
|
||||||
// Value should be clamped to Min / Max after spinning
|
// Value should be clamped to Min / Max after spinning
|
||||||
yield return [200m, 400m, 5m, SpinDirection.Increase, 200m];
|
yield return [200m, 400m, 5m, SpinDirection.Increase, 200m];
|
||||||
yield return [200m, 400m, 200m, SpinDirection.Decrease, 200m];
|
yield return [200m, 400m, 200m, SpinDirection.Decrease, 200m];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunTest(Action<NumericUpDown, TextBox> test)
|
private void RunTest(Action<NumericUpDown, TextBox> test)
|
||||||
{
|
{
|
||||||
using (UnitTestApplication.Start(Services))
|
using (UnitTestApplication.Start(Services))
|
||||||
@@ -148,14 +148,14 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
.OfType<TextBox>()
|
.OfType<TextBox>()
|
||||||
.First();
|
.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ButtonSpinner GetSpinner(NumericUpDown control)
|
private static ButtonSpinner GetSpinner(NumericUpDown control)
|
||||||
{
|
{
|
||||||
return control.GetTemplateChildren()
|
return control.GetTemplateChildren()
|
||||||
.OfType<ButtonSpinner>()
|
.OfType<ButtonSpinner>()
|
||||||
.First();
|
.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IControlTemplate CreateTemplate()
|
private static IControlTemplate CreateTemplate()
|
||||||
{
|
{
|
||||||
return new FuncControlTemplate<NumericUpDown>((control, scope) =>
|
return new FuncControlTemplate<NumericUpDown>((control, scope) =>
|
||||||
@@ -180,14 +180,27 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
{
|
{
|
||||||
// Set TabIndex on NumericUpDown
|
// Set TabIndex on NumericUpDown
|
||||||
control.TabIndex = 5;
|
control.TabIndex = 5;
|
||||||
|
|
||||||
// The inner TextBox should inherit the same TabIndex
|
// The inner TextBox should inherit the same TabIndex
|
||||||
Assert.Equal(5, textbox.TabIndex);
|
Assert.Equal(5, textbox.TabIndex);
|
||||||
|
|
||||||
// Change TabIndex and verify it gets synchronized
|
// Change TabIndex and verify it gets synchronized
|
||||||
control.TabIndex = 10;
|
control.TabIndex = 10;
|
||||||
Assert.Equal(10, textbox.TabIndex);
|
Assert.Equal(10, textbox.TabIndex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PlaceholderForeground_Can_Be_Set()
|
||||||
|
{
|
||||||
|
using (UnitTestApplication.Start(Services))
|
||||||
|
{
|
||||||
|
var control = CreateControl();
|
||||||
|
control.PlaceholderText = "Enter value";
|
||||||
|
control.PlaceholderForeground = Media.Brushes.Red;
|
||||||
|
|
||||||
|
Assert.Equal(Media.Brushes.Red, control.PlaceholderForeground);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,25 +42,25 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
Text = "5678"
|
Text = "5678"
|
||||||
};
|
};
|
||||||
|
|
||||||
var sp = new StackPanel();
|
var sp = new StackPanel();
|
||||||
sp.Children.Add(target1);
|
sp.Children.Add(target1);
|
||||||
sp.Children.Add(target2);
|
sp.Children.Add(target2);
|
||||||
|
|
||||||
target1.ApplyTemplate();
|
target1.ApplyTemplate();
|
||||||
target2.ApplyTemplate();
|
target2.ApplyTemplate();
|
||||||
|
|
||||||
var root = new TestRoot() { Child = sp };
|
var root = new TestRoot() { Child = sp };
|
||||||
|
|
||||||
target1.SelectionStart = 0;
|
target1.SelectionStart = 0;
|
||||||
target1.SelectionEnd = 3;
|
target1.SelectionEnd = 3;
|
||||||
|
|
||||||
target1.Focus();
|
target1.Focus();
|
||||||
Assert.False(target2.IsFocused);
|
Assert.False(target2.IsFocused);
|
||||||
Assert.True(target1.IsFocused);
|
Assert.True(target1.IsFocused);
|
||||||
|
|
||||||
target2.Focus();
|
target2.Focus();
|
||||||
|
|
||||||
Assert.Equal("123", target1.SelectedText);
|
Assert.Equal("123", target1.SelectedText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
target1.ApplyTemplate();
|
target1.ApplyTemplate();
|
||||||
|
|
||||||
@@ -165,16 +165,16 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
target.Measure(Size.Infinity);
|
target.Measure(Size.Infinity);
|
||||||
|
|
||||||
target.CaretIndex = 3;
|
target.CaretIndex = 3;
|
||||||
RaiseKeyEvent(target, Key.Right, 0);
|
RaiseKeyEvent(target, Key.Right, 0);
|
||||||
|
|
||||||
Assert.Equal(4, target.CaretIndex);
|
Assert.Equal(4, target.CaretIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Control_Backspace_Should_Set_Caret_Position_To_The_Start_Of_The_Deletion()
|
public void Control_Backspace_Should_Set_Caret_Position_To_The_Start_Of_The_Deletion()
|
||||||
{
|
{
|
||||||
@@ -194,11 +194,11 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
// (First Second |Third)
|
// (First Second |Third)
|
||||||
RaiseKeyEvent(target, Key.Back, KeyModifiers.Control);
|
RaiseKeyEvent(target, Key.Back, KeyModifiers.Control);
|
||||||
// (First |Third)
|
// (First |Third)
|
||||||
|
|
||||||
Assert.Equal(6, target.CaretIndex);
|
Assert.Equal(6, target.CaretIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Control_Backspace_Should_Remove_The_Double_Whitespace_If_Caret_Index_Was_At_The_End_Of_A_Word()
|
public void Control_Backspace_Should_Remove_The_Double_Whitespace_If_Caret_Index_Was_At_The_End_Of_A_Word()
|
||||||
{
|
{
|
||||||
@@ -213,7 +213,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
// (First Second| Third)
|
// (First Second| Third)
|
||||||
RaiseKeyEvent(target, Key.Back, KeyModifiers.Control);
|
RaiseKeyEvent(target, Key.Back, KeyModifiers.Control);
|
||||||
// (First| Third)
|
// (First| Third)
|
||||||
@@ -236,11 +236,11 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
// (First Second| Third)
|
// (First Second| Third)
|
||||||
RaiseKeyEvent(target, Key.Back, KeyModifiers.Control);
|
RaiseKeyEvent(target, Key.Back, KeyModifiers.Control);
|
||||||
// (First| Third)
|
// (First| Third)
|
||||||
|
|
||||||
target.Undo();
|
target.Undo();
|
||||||
// (First Second| Third)
|
// (First Second| Third)
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
Text = "1234"
|
Text = "1234"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
RaiseKeyEvent(target, Key.A, KeyModifiers.Control);
|
RaiseKeyEvent(target, Key.A, KeyModifiers.Control);
|
||||||
@@ -314,7 +314,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
SelectionStart = 5,
|
SelectionStart = 5,
|
||||||
SelectionEnd = 5
|
SelectionEnd = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
textBox.ApplyTemplate();
|
textBox.ApplyTemplate();
|
||||||
|
|
||||||
// (First| Second Third Fourth)
|
// (First| Second Third Fourth)
|
||||||
@@ -356,7 +356,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Text = "First Second Third Fourth",
|
Text = "First Second Third Fourth",
|
||||||
CaretIndex = 19,
|
CaretIndex = 19,
|
||||||
};
|
};
|
||||||
|
|
||||||
textBox.ApplyTemplate();
|
textBox.ApplyTemplate();
|
||||||
|
|
||||||
// (First Second Third |Fourth)
|
// (First Second Third |Fourth)
|
||||||
@@ -400,7 +400,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
textBox.SelectionStart = 2;
|
textBox.SelectionStart = 2;
|
||||||
textBox.SelectionEnd = 2;
|
textBox.SelectionEnd = 2;
|
||||||
|
|
||||||
Assert.Equal(2, textBox.CaretIndex);
|
Assert.Equal(2, textBox.CaretIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,7 +443,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
AcceptsReturn = false,
|
AcceptsReturn = false,
|
||||||
Text = "1234"
|
Text = "1234"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
RaiseKeyEvent(target, Key.Enter, 0);
|
RaiseKeyEvent(target, Key.Enter, 0);
|
||||||
@@ -462,7 +462,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
AcceptsReturn = true
|
AcceptsReturn = true
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
RaiseKeyEvent(target, Key.Enter, 0);
|
RaiseKeyEvent(target, Key.Enter, 0);
|
||||||
@@ -482,7 +482,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
AcceptsReturn = true,
|
AcceptsReturn = true,
|
||||||
NewLine = "Test"
|
NewLine = "Test"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
RaiseKeyEvent(target, Key.Enter, 0);
|
RaiseKeyEvent(target, Key.Enter, 0);
|
||||||
@@ -523,7 +523,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
Text = "0123456789"
|
Text = "0123456789"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
target.SelectionStart = 0;
|
target.SelectionStart = 0;
|
||||||
@@ -547,7 +547,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
Text = "0123456789"
|
Text = "0123456789"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
target.SelectionStart = 8;
|
target.SelectionStart = 8;
|
||||||
@@ -592,7 +592,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
Text = "0123456789"
|
Text = "0123456789"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
Assert.True(target.SelectedText == "");
|
Assert.True(target.SelectedText == "");
|
||||||
@@ -614,7 +614,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Template = CreateTemplate(),
|
Template = CreateTemplate(),
|
||||||
Text = "0123"
|
Text = "0123"
|
||||||
};
|
};
|
||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
|
|
||||||
target.SelectedText = "AA";
|
target.SelectedText = "AA";
|
||||||
@@ -679,7 +679,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.True(true);
|
Assert.True(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(Key.Up)]
|
[InlineData(Key.Up)]
|
||||||
[InlineData(Key.Down)]
|
[InlineData(Key.Down)]
|
||||||
@@ -725,7 +725,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
target1.ApplyTemplate();
|
target1.ApplyTemplate();
|
||||||
target2.ApplyTemplate();
|
target2.ApplyTemplate();
|
||||||
|
|
||||||
var root = new TestRoot { Child = sp };
|
var root = new TestRoot { Child = sp };
|
||||||
|
|
||||||
var gfcount = 0;
|
var gfcount = 0;
|
||||||
@@ -746,7 +746,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal(1, lfcount);
|
Assert.Equal(1, lfcount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TextBox_CaretIndex_Persists_When_Focus_Lost()
|
public void TextBox_CaretIndex_Persists_When_Focus_Lost()
|
||||||
{
|
{
|
||||||
@@ -768,7 +768,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
target1.ApplyTemplate();
|
target1.ApplyTemplate();
|
||||||
target2.ApplyTemplate();
|
target2.ApplyTemplate();
|
||||||
|
|
||||||
var root = new TestRoot { Child = sp };
|
var root = new TestRoot { Child = sp };
|
||||||
|
|
||||||
target2.Focus();
|
target2.Focus();
|
||||||
@@ -777,11 +777,11 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.True(target2.IsFocused);
|
Assert.True(target2.IsFocused);
|
||||||
|
|
||||||
target1.Focus();
|
target1.Focus();
|
||||||
|
|
||||||
Assert.Equal(2, target2.CaretIndex);
|
Assert.Equal(2, target2.CaretIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TextBox_Reveal_Password_Reset_When_Lost_Focus()
|
public void TextBox_Reveal_Password_Reset_When_Lost_Focus()
|
||||||
{
|
{
|
||||||
@@ -804,14 +804,14 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
target1.ApplyTemplate();
|
target1.ApplyTemplate();
|
||||||
target2.ApplyTemplate();
|
target2.ApplyTemplate();
|
||||||
|
|
||||||
var root = new TestRoot { Child = sp };
|
var root = new TestRoot { Child = sp };
|
||||||
|
|
||||||
target1.Focus();
|
target1.Focus();
|
||||||
target1.RevealPassword = true;
|
target1.RevealPassword = true;
|
||||||
|
|
||||||
target2.Focus();
|
target2.Focus();
|
||||||
|
|
||||||
Assert.False(target1.RevealPassword);
|
Assert.False(target1.RevealPassword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -833,7 +833,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Null(target.Text);
|
Assert.Null(target.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("abc", "d", 3, 0, 0, false, "abc")]
|
[InlineData("abc", "d", 3, 0, 0, false, "abc")]
|
||||||
[InlineData("abc", "dd", 4, 3, 3, false, "abcd")]
|
[InlineData("abc", "dd", 4, 3, 3, false, "abcd")]
|
||||||
@@ -870,7 +870,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
topLevel.LayoutManager.ExecuteInitialLayoutPass();
|
topLevel.LayoutManager.ExecuteInitialLayoutPass();
|
||||||
|
|
||||||
target.Measure(Size.Infinity);
|
target.Measure(Size.Infinity);
|
||||||
|
|
||||||
if (fromClipboard)
|
if (fromClipboard)
|
||||||
{
|
{
|
||||||
await topLevel.Clipboard!.SetTextAsync(textInput);
|
await topLevel.Clipboard!.SetTextAsync(textInput);
|
||||||
@@ -882,7 +882,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
{
|
{
|
||||||
RaiseTextEvent(target, textInput);
|
RaiseTextEvent(target, textInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.Equal(expected, target.Text);
|
Assert.Equal(expected, target.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1246,7 +1246,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal((minLines * target.LineHeight) + textPresenterMargin.Top + textPresenterMargin.Bottom, scrollViewer.MinHeight);
|
Assert.Equal((minLines * target.LineHeight) + textPresenterMargin.Top + textPresenterMargin.Bottom, scrollViewer.MinHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(null, 1)]
|
[InlineData(null, 1)]
|
||||||
[InlineData("", 1)]
|
[InlineData("", 1)]
|
||||||
@@ -1285,7 +1285,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
var b = new TextBox();
|
var b = new TextBox();
|
||||||
Assert.Equal(-1, b.GetLineCount());
|
Assert.Equal(-1, b.GetLineCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LineCount_Is_Correct_After_Text_Change()
|
public void LineCount_Is_Correct_After_Text_Change()
|
||||||
{
|
{
|
||||||
@@ -1309,7 +1309,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
target.ApplyTemplate();
|
target.ApplyTemplate();
|
||||||
target.Measure(Size.Infinity);
|
target.Measure(Size.Infinity);
|
||||||
|
|
||||||
Assert.Equal(1, target.GetLineCount());
|
Assert.Equal(1, target.GetLineCount());
|
||||||
|
|
||||||
target.Text = "Hello\r\nWorld";
|
target.Text = "Hello\r\nWorld";
|
||||||
@@ -1505,7 +1505,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal("ABCDEF123", tb.Text);
|
Assert.Equal("ABCDEF123", tb.Text);
|
||||||
|
|
||||||
// Undo will take us back one step
|
// Undo will take us back one step
|
||||||
tb.Undo();
|
tb.Undo();
|
||||||
Assert.Equal("ABCDEF", tb.Text);
|
Assert.Equal("ABCDEF", tb.Text);
|
||||||
|
|
||||||
// Undo again
|
// Undo again
|
||||||
@@ -2050,7 +2050,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.NotNull(client);
|
Assert.NotNull(client);
|
||||||
Assert.Equal(string.Empty, client.SurroundingText);
|
Assert.Equal(string.Empty, client.SurroundingText);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Backspace_Should_Delete_Last_Character_In_Line_And_Keep_Caret_On_Same_Line()
|
public void Backspace_Should_Delete_Last_Character_In_Line_And_Keep_Caret_On_Same_Line()
|
||||||
{
|
{
|
||||||
@@ -2122,7 +2122,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
|
|
||||||
Assert.True(target1.IsFocused);
|
Assert.True(target1.IsFocused);
|
||||||
|
|
||||||
Assert.Equal("1234", target1.SelectedText);
|
Assert.Equal("1234", target1.SelectedText);
|
||||||
|
|
||||||
target2.Focus();
|
target2.Focus();
|
||||||
|
|
||||||
@@ -2149,6 +2149,61 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
Assert.Equal("FirstSecond", target.Text);
|
Assert.Equal("FirstSecond", target.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PlaceholderForeground_Can_Be_Set()
|
||||||
|
{
|
||||||
|
using (UnitTestApplication.Start(Services))
|
||||||
|
{
|
||||||
|
var target = new TextBox
|
||||||
|
{
|
||||||
|
Template = CreateTemplate(),
|
||||||
|
PlaceholderText = "Enter text",
|
||||||
|
PlaceholderForeground = Brushes.Red
|
||||||
|
};
|
||||||
|
|
||||||
|
target.ApplyTemplate();
|
||||||
|
|
||||||
|
Assert.Equal(Brushes.Red, target.PlaceholderForeground);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PlaceholderForeground_Defaults_To_Null()
|
||||||
|
{
|
||||||
|
using (UnitTestApplication.Start(Services))
|
||||||
|
{
|
||||||
|
var target = new TextBox
|
||||||
|
{
|
||||||
|
Template = CreateTemplate(),
|
||||||
|
PlaceholderText = "Enter text"
|
||||||
|
};
|
||||||
|
|
||||||
|
target.ApplyTemplate();
|
||||||
|
|
||||||
|
Assert.Null(target.PlaceholderForeground);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PlaceholderForeground_Can_Be_Set_To_Null()
|
||||||
|
{
|
||||||
|
using (UnitTestApplication.Start(Services))
|
||||||
|
{
|
||||||
|
var target = new TextBox
|
||||||
|
{
|
||||||
|
Template = CreateTemplate(),
|
||||||
|
PlaceholderText = "Enter text",
|
||||||
|
PlaceholderForeground = Brushes.Blue
|
||||||
|
};
|
||||||
|
|
||||||
|
target.ApplyTemplate();
|
||||||
|
|
||||||
|
target.PlaceholderForeground = null;
|
||||||
|
|
||||||
|
Assert.Null(target.PlaceholderForeground);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static TestServices FocusServices => TestServices.MockThreadingInterface.With(
|
private static TestServices FocusServices => TestServices.MockThreadingInterface.With(
|
||||||
keyboardDevice: () => new KeyboardDevice(),
|
keyboardDevice: () => new KeyboardDevice(),
|
||||||
keyboardNavigation: () => new KeyboardNavigationHandler(),
|
keyboardNavigation: () => new KeyboardNavigationHandler(),
|
||||||
@@ -2160,7 +2215,7 @@ namespace Avalonia.Controls.UnitTests
|
|||||||
private static TestServices Services => TestServices.MockThreadingInterface.With(
|
private static TestServices Services => TestServices.MockThreadingInterface.With(
|
||||||
standardCursorFactory: Mock.Of<ICursorFactory>(),
|
standardCursorFactory: Mock.Of<ICursorFactory>(),
|
||||||
renderInterface: new HeadlessPlatformRenderInterface(),
|
renderInterface: new HeadlessPlatformRenderInterface(),
|
||||||
textShaperImpl: new HarfBuzzTextShaper(),
|
textShaperImpl: new HarfBuzzTextShaper(),
|
||||||
fontManagerImpl: new TestFontManager(),
|
fontManagerImpl: new TestFontManager(),
|
||||||
assetLoader: new StandardAssetLoader());
|
assetLoader: new StandardAssetLoader());
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
x:Class="Sample.App.AttachedProps"
|
x:Class="Sample.App.AttachedProps"
|
||||||
Design.Width="300">
|
Design.Width="300">
|
||||||
<TextBox Name="UserNameTextBox"
|
<TextBox Name="UserNameTextBox"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
x:Class="Sample.App.ControlWithoutWindow"
|
x:Class="Sample.App.ControlWithoutWindow"
|
||||||
Design.Width="300">
|
Design.Width="300">
|
||||||
<TextBox Name="UserNameTextBox"
|
<TextBox Name="UserNameTextBox"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
x:Class="Sample.App.DataTemplates">
|
x:Class="Sample.App.DataTemplates">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBox x:Name="UserNameTextBox"
|
<TextBox x:Name="UserNameTextBox"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<ListBox Name="NamedListBox">
|
<ListBox Name="NamedListBox">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate x:Name="NamedDataTemplate">
|
<DataTemplate x:Name="NamedDataTemplate">
|
||||||
<TextBox x:Name="TemplatedTextBox"
|
<TextBox x:Name="TemplatedTextBox"
|
||||||
Watermark="Templated input"
|
Placeholder="Templated input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
|||||||
@@ -4,20 +4,20 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBox Name="FirstNameTextBox"
|
<TextBox Name="FirstNameTextBox"
|
||||||
x:FieldModifier="Public"
|
x:FieldModifier="Public"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBox Name="LastNameTextBox"
|
<TextBox Name="LastNameTextBox"
|
||||||
x:FieldModifier="public"
|
x:FieldModifier="public"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBox Name="PasswordTextBox"
|
<TextBox Name="PasswordTextBox"
|
||||||
x:FieldModifier="protected"
|
x:FieldModifier="protected"
|
||||||
Watermark="Password input"
|
Placeholder="Password input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBox Name="ConfirmPasswordTextBox"
|
<TextBox Name="ConfirmPasswordTextBox"
|
||||||
x:FieldModifier="private"
|
x:FieldModifier="private"
|
||||||
Watermark="Password input"
|
Placeholder="Password input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<Button Name="SignUpButton"
|
<Button Name="SignUpButton"
|
||||||
x:FieldModifier="NotPublic"
|
x:FieldModifier="NotPublic"
|
||||||
Content="Sign up" />
|
Content="Sign up" />
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
x:Class="Sample.App.NamedControl">
|
x:Class="Sample.App.NamedControl">
|
||||||
<TextBox Name="UserNameTextBox"
|
<TextBox Name="UserNameTextBox"
|
||||||
AutomationProperties.Name="The user name"
|
AutomationProperties.Name="The user name"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
x:Class="Sample.App.NamedControls">
|
x:Class="Sample.App.NamedControls">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBox Name="UserNameTextBox"
|
<TextBox Name="UserNameTextBox"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBox Name="PasswordTextBox"
|
<TextBox Name="PasswordTextBox"
|
||||||
Watermark="Password input"
|
Placeholder="Password input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<Button Name="SignUpButton"
|
<Button Name="SignUpButton"
|
||||||
Content="Sign up" />
|
Content="Sign up" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="Sample.App.NoNamedControls">
|
x:Class="Sample.App.NoNamedControls">
|
||||||
<TextBox Watermark="Username input"
|
<TextBox Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
</Window>
|
</Window>
|
||||||
@@ -5,15 +5,15 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<controls:CustomTextBox Margin="0 10 0 0"
|
<controls:CustomTextBox Margin="0 10 0 0"
|
||||||
Name="UserNameTextBox"
|
Name="UserNameTextBox"
|
||||||
Watermark="Please, enter user name..."
|
Placeholder="Please, enter user name..."
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBlock Name="UserNameValidation"
|
<TextBlock Name="UserNameValidation"
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
FontSize="12" />
|
FontSize="12" />
|
||||||
<TextBox Margin="0 10 0 0"
|
<TextBox Margin="0 10 0 0"
|
||||||
Name="PasswordTextBox"
|
Name="PasswordTextBox"
|
||||||
Watermark="Please, enter your password..."
|
Placeholder="Please, enter your password..."
|
||||||
UseFloatingWatermark="True"
|
UseFloatingPlaceholder="True"
|
||||||
PasswordChar="*" />
|
PasswordChar="*" />
|
||||||
<TextBlock Name="PasswordValidation"
|
<TextBlock Name="PasswordValidation"
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
</ListBox>
|
</ListBox>
|
||||||
<TextBox Margin="0 10 0 0"
|
<TextBox Margin="0 10 0 0"
|
||||||
x:Name="ConfirmPasswordTextBox"
|
x:Name="ConfirmPasswordTextBox"
|
||||||
Watermark="Please, confirm the password..."
|
Placeholder="Please, confirm the password..."
|
||||||
UseFloatingWatermark="True"
|
UseFloatingPlaceholder="True"
|
||||||
PasswordChar="*" />
|
PasswordChar="*" />
|
||||||
<TextBlock x:Name="ConfirmPasswordValidation"
|
<TextBlock x:Name="ConfirmPasswordValidation"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
x:Class="Sample.App.xNamedControl">
|
x:Class="Sample.App.xNamedControl">
|
||||||
<TextBox x:Name="UserNameTextBox"
|
<TextBox x:Name="UserNameTextBox"
|
||||||
AutomationProperties.Name="The user name"
|
AutomationProperties.Name="The user name"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
x:Class="Sample.App.xNamedControls">
|
x:Class="Sample.App.xNamedControls">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBox x:Name="UserNameTextBox"
|
<TextBox x:Name="UserNameTextBox"
|
||||||
Watermark="Username input"
|
Placeholder="Username input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<TextBox x:Name="PasswordTextBox"
|
<TextBox x:Name="PasswordTextBox"
|
||||||
Watermark="Password input"
|
Placeholder="Password input"
|
||||||
UseFloatingWatermark="True" />
|
UseFloatingPlaceholder="True" />
|
||||||
<!-- Name generator should still generate members, even if XAML is invalid -->
|
<!-- Name generator should still generate members, even if XAML is invalid -->
|
||||||
<Button x:Name="SignUpButton"
|
<Button x:Name="SignUpButton"
|
||||||
Content="{x:Static NonExistent.Member}" />
|
Content="{x:Static NonExistent.Member}" />
|
||||||
|
|||||||
@@ -71,14 +71,14 @@ namespace Avalonia.Markup.Xaml.UnitTests.Data
|
|||||||
<Window xmlns='https://github.com/avaloniaui'
|
<Window xmlns='https://github.com/avaloniaui'
|
||||||
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
|
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
|
||||||
xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.Data;assembly=Avalonia.Markup.Xaml.UnitTests'>
|
xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.Data;assembly=Avalonia.Markup.Xaml.UnitTests'>
|
||||||
<TextBox Name='textBox' Text='Foo' Watermark='Bar'>
|
<TextBox Name='textBox' Text='Foo' PlaceholderText='Bar'>
|
||||||
<TextBox.Template>
|
<TextBox.Template>
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<TextPresenter Name='PART_TextPresenter'>
|
<TextPresenter Name='PART_TextPresenter'>
|
||||||
<TextPresenter.Text>
|
<TextPresenter.Text>
|
||||||
<MultiBinding Converter='{x:Static local:ConcatConverter.Instance}'>
|
<MultiBinding Converter='{x:Static local:ConcatConverter.Instance}'>
|
||||||
<Binding RelativeSource='{RelativeSource TemplatedParent}' Path='Text'/>
|
<Binding RelativeSource='{RelativeSource TemplatedParent}' Path='Text'/>
|
||||||
<Binding RelativeSource='{RelativeSource TemplatedParent}' Path='Watermark'/>
|
<Binding RelativeSource='{RelativeSource TemplatedParent}' Path='PlaceholderText'/>
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</TextPresenter.Text>
|
</TextPresenter.Text>
|
||||||
</TextPresenter>
|
</TextPresenter>
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Presenters;
|
||||||
|
using Avalonia.Controls.Templates;
|
||||||
|
using Avalonia.Layout;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Avalonia.Skia.RenderTests
|
||||||
|
{
|
||||||
|
public class TextBoxTests : TestBase
|
||||||
|
{
|
||||||
|
public TextBoxTests()
|
||||||
|
: base(@"Controls\TextBox")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IControlTemplate CreateTextBoxTemplate()
|
||||||
|
{
|
||||||
|
return new FuncControlTemplate<TextBox>((textBox, scope) =>
|
||||||
|
{
|
||||||
|
var border = new Border
|
||||||
|
{
|
||||||
|
Background = textBox.Background,
|
||||||
|
BorderBrush = Brushes.Gray,
|
||||||
|
BorderThickness = new Thickness(1),
|
||||||
|
Padding = new Thickness(4),
|
||||||
|
};
|
||||||
|
|
||||||
|
var panel = new Panel();
|
||||||
|
|
||||||
|
// Use Antialias mode
|
||||||
|
TextOptions.SetTextRenderingMode(panel, TextRenderingMode.Antialias);
|
||||||
|
|
||||||
|
var placeholder = new TextBlock
|
||||||
|
{
|
||||||
|
Name = "PART_Placeholder",
|
||||||
|
[!TextBlock.TextProperty] = textBox[!TextBox.PlaceholderTextProperty],
|
||||||
|
[!TextBlock.ForegroundProperty] = textBox[!TextBox.PlaceholderForegroundProperty],
|
||||||
|
FontFamily = textBox.FontFamily,
|
||||||
|
FontSize = textBox.FontSize,
|
||||||
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
|
Opacity = 0.5,
|
||||||
|
}.RegisterInNameScope(scope);
|
||||||
|
|
||||||
|
var presenter = new TextPresenter
|
||||||
|
{
|
||||||
|
Name = "PART_TextPresenter",
|
||||||
|
[!TextPresenter.TextProperty] = textBox[!TextBox.TextProperty],
|
||||||
|
[!TextPresenter.CaretIndexProperty] = textBox[!TextBox.CaretIndexProperty],
|
||||||
|
FontFamily = textBox.FontFamily,
|
||||||
|
FontSize = textBox.FontSize,
|
||||||
|
}.RegisterInNameScope(scope);
|
||||||
|
|
||||||
|
panel.Children.Add(placeholder);
|
||||||
|
panel.Children.Add(presenter);
|
||||||
|
border.Child = panel;
|
||||||
|
|
||||||
|
return border;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Placeholder_With_Red_Foreground()
|
||||||
|
{
|
||||||
|
var target = new Border
|
||||||
|
{
|
||||||
|
Padding = new Thickness(8),
|
||||||
|
Width = 200,
|
||||||
|
Height = 50,
|
||||||
|
Background = Brushes.White,
|
||||||
|
Child = new TextBox
|
||||||
|
{
|
||||||
|
Template = CreateTextBoxTemplate(),
|
||||||
|
FontFamily = TestFontFamily,
|
||||||
|
FontSize = 12,
|
||||||
|
Background = Brushes.White,
|
||||||
|
PlaceholderText = "Red placeholder",
|
||||||
|
PlaceholderForeground = Brushes.Red,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await RenderToFile(target);
|
||||||
|
CompareImages();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Placeholder_With_Blue_Foreground()
|
||||||
|
{
|
||||||
|
var target = new Border
|
||||||
|
{
|
||||||
|
Padding = new Thickness(8),
|
||||||
|
Width = 200,
|
||||||
|
Height = 50,
|
||||||
|
Background = Brushes.White,
|
||||||
|
Child = new TextBox
|
||||||
|
{
|
||||||
|
Template = CreateTextBoxTemplate(),
|
||||||
|
FontFamily = TestFontFamily,
|
||||||
|
FontSize = 12,
|
||||||
|
Background = Brushes.White,
|
||||||
|
PlaceholderText = "Blue placeholder",
|
||||||
|
PlaceholderForeground = Brushes.Blue,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await RenderToFile(target);
|
||||||
|
CompareImages();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Placeholder_With_Default_Foreground()
|
||||||
|
{
|
||||||
|
var target = new Border
|
||||||
|
{
|
||||||
|
Padding = new Thickness(8),
|
||||||
|
Width = 200,
|
||||||
|
Height = 50,
|
||||||
|
Background = Brushes.White,
|
||||||
|
Child = new TextBox
|
||||||
|
{
|
||||||
|
Template = CreateTextBoxTemplate(),
|
||||||
|
FontFamily = TestFontFamily,
|
||||||
|
FontSize = 12,
|
||||||
|
Background = Brushes.White,
|
||||||
|
PlaceholderText = "Default placeholder",
|
||||||
|
PlaceholderForeground = Brushes.Gray,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await RenderToFile(target);
|
||||||
|
CompareImages();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Reference in New Issue
Block a user