Twoway обязательна в wasm - PullRequest
       43

Twoway обязательна в wasm

0 голосов
/ 27 октября 2019

Я тестирую платформу Uno и wasm.

Я тестирую простую привязку данных, где у меня есть имя пользователя в текстовом поле после входа в систему через веб-интерфейс. Я обновляю свойство имени пользователя, чтобы проверить обновление графического интерфейса пользователя из свойства привязки в viewmodel.

XAML.

в кнопке входа в систему

        var result = await webApiClient.LoginUser(ViewModel.LoginModel);
        ViewModel.LoginModel.Email = result.Model.Name;

Если я запускаю приложение под UWP, оно работает, под wasm текстовое поле не обновляется.

<Page
x:Class="DeviceExchange.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DeviceExchange"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ios="http://nventive.com/ios"
xmlns:wasm="http://nventive.com/wasm"
mc:Ignorable="d ios wasm">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="1" Grid.Column="1" Text="Device Exchange 
 Portal" Margin="20" FontSize="30" />
     <TextBlock Grid.Row="2" Grid.Column="1" Text="username" Margin="3" 
 FontSize="15" />
     <TextBox Grid.Row="3" Grid.Column="1" Text="{x:Bind LoginModel.Email, 
 Mode=TwoWay}" Background="White" />
     <TextBlock Grid.Row="4" Grid.Column="1" Text="username" Margin="3" 
 FontSize="15" />
     <PasswordBox Grid.Row="5" Grid.Column="1" Password="{x:Bind 
LoginModel.Password, Mode=TwoWay}" Background="White"/>
     <Button Margin="0,5" Click="LoginButton_Click" 
VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Row="6" 
Grid.Column="1" x:Name="LoginButton" Content="Login" />
 </Grid>
 </Page>
...