我有这样的代码:
<Page
x:Class="App4.Views.AddPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App4.Views"
xmlns:conv="using:App4.Converters"
xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
DataContext="{Binding AddPageInstance, Source={StaticResource Locator}}"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<conv:SalaryConverter x:Key="SalaryConverter"/>
</Page.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Padding="20" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="300">
<TextBox Text="{x:Bind Vm.Name, Mode=TwoWay}"
x:Name="CharactValidator"
Header="Name"
PlaceholderText="Type Name here"
extensions:TextBoxRegex.ValidationMode="Dynamic"
extensions:TextBoxRegex.ValidationType="Characters"/>
<TextBlock Text="{Binding (extensions:TextBoxRegex.IsValid), ElementName=CharactValidator}"/>
<TextBlock Text="Salary"/>
<TextBox Text="{x:Bind Vm.Salary, Mode=TwoWay, Converter={StaticResource SalaryConverter}}" PlaceholderText="Type Salary here"/>
<TextBlock/>
<TextBlock Text="Title"/>
<TextBox Text="{x:Bind Vm.Title, Mode=TwoWay}" PlaceholderText="Type Title here"/>
<TextBlock/>
<TextBlock Text="Surname"/>
<TextBox Text="{x:Bind Vm.Surname, Mode=TwoWay}" PlaceholderText="Type Surname here"/>
<TextBlock/>
</StackPanel>
</Grid>
问题是我在与扩展程序相关的错误:
无法将“动态”转换为“ Microsoft.Toolkit.Uwp.UI.Extensions.TextBoxRegex + ValidationMode”类型的对象
无法将“字符”转换为“ Microsoft.Toolkit.Uwp.UI.Extensions.TextBoxRegex + ValidationType”类型的对象
错误无法设置“路径”
构建应用程序后,它运行良好。但是我不知道如何删除这些错误消息以及它为什么出现。如果需要任何其他信息,请询问我。
谢谢, 康拉德
答案 0 :(得分:0)