여기서 mMaterialCentreGroupListView.xaml
파일에이 줄은 MaterialCentreGroupView
으로 작성되었습니다. 하지만 viewmodel 속성에 액세스하기위한 데이터 컨텍스트를 볼 수 없습니다. 그것은 잘 작동하고 있습니다. 아래는 코드입니다.Datacontext가 지정되는 방법
<vw:MaterialCentreGroupView
Style="{StaticResource DetailedViewStyle}"
DataContext="{Binding SelectedMaterialCentreGroup}"/>
<UserControl x:Class="MyBooks.View.MaterialCentreGroupView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinWidth="290" MaxWidth="290" Padding="20"
Background="#eee">
<UserControl.Resources>
<ResourceDictionary Source="ViewResources.xaml" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label
Grid.Row="0" Grid.Column="0"
Content="{Resx ResxName=MyBooks.Properties.Strings, Key=AccountCategoryListView_Name_Label}"
HorizontalAlignment="Right"/>
<TextBox
x:Name="CategoryName"
MaxLength="50"
Style="{StaticResource FormControlStyle}"
Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"
Text="{Binding Path=Name, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"/>
일이 발생할 어떻게 바인딩 무엇인지 나에게 설명해주십시오보기?
@StellerEleven를 참조하십시오 여기 materailcenterGroupListView.xaml에서이 줄을 지정하는 <폭스 바겐 : MaterialCentreGroupView의 DataContext = "{Binding SelectedMaterialCentreGroup}"/> 및 viewmodel에서 Public MaterialCentreGroupViewModel SelectedMaterialCentreGroup {return _selectedMaterialCentreGroup; }가 지정되었습니다. – pratikjgandhi