我的xaml.cs
public partial class ViewersWindowEditor : Window
{
public ViewersWindowEditor()
{
InitializeComponent();
}
private static Logger _logger = LogManager.GetCurrentClassLogger();
public VIEWER SelectedViewer { private get; set; }
private void ViewersWindowEditor_OnLoaded(object sender, RoutedEventArgs e)
{
//throw new NotImplementedException();
}
}
和此xaml代码:
<StackPanel Name="spField" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" DataContext="{StaticResource SelectedViewer}" >
<TextBox Name="txtName" Width="150" Text="{Binding NAME, Mode=OneWay}">
</StackPanel>
我想绑定txtName = SelectedVIewer.NAME