是否可以将文本框绑定在itemcontrol的itemssource之外。
我刚开始编写wpf,所以我不知道。
这是我的代码:
<Page x:Class="InformationSys.View.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InformationSys.View"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="Page1"
DataContext="{Binding Information, Source={StaticResource Locator}}">
<ItemsControl ItemsSource="{Binding Gender}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".4*"/>
<ColumnDefinition Width=".3*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding IsChecked}" FlowDirection="RightToLeft" Grid.Column="0" VerticalAlignment="Bottom">
<TextBlock Text="{Binding Gen_Type}"/>
</CheckBox>
<TextBox x:Name="textBox5" Grid.Column="1" Grid.Row="4" Margin="20 0 0 0" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Page>
谢谢!