0
wpf app에서 시작합니다. MVVM patern을 연습하려고합니다. Usercontrol의 datacontext를 바인딩하는 데 문제가 있습니다.UserControl의 데이터 인터페이스 바인딩
<UserControl x:Class="Test.Views.Login.Identifer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Test.ViewModels"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="480" d:DesignWidth="480">
<UserControl.DataContext>
<vm:Login/>
</UserControl.DataContext>
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox Name="user"></TextBox>
<TextBox Grid.Row="1" Name="password"></TextBox>
</Grid>
이 내 UserControl을하고 로그인 내 데이터 컨텍스트에 바인딩 할 내 클래스입니다.
<phone:PhoneApplicationPage
x:Class="Test.Views.Login.Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Views="clr-namespace:Test.Views.Login"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot est la grille racine où tout le contenu de la page est placé-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Views:Identifer></Views:Identifer>
</Grid>
그리고 내 로그인 클래스와 finsih거야 : 내 PhonApplicationPage이 UserControl을 넣어
using Test.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test.ViewModels
{
class Login : MyNotifyPropertyChanged
{
public Client client_ { get; set; }
public Login()
{
client_ = new Client();
}
}
}
그리고 다음과 같은 오류가 있어요 : Erreur 1 'Test.ViewModels.Login'유형의 인스턴스를 만들 수 없습니다 [라인 : 14 위치 : 19]
감사합니다. 이 공개해야 할 때
롤, 감사합니다. – king