ฉันต้องใช้เวลาเล็กน้อยมาวันนี้เป็นวันที่ปัญหานี้และฉันแน่นอเงื่อนงำน้อยมาก ถ้าฉันอคลิกที่ปุ่มนี้เพื่อให้มีการแสดงที่สองมุมมองมันจะเปิดแต่โดยไม่ต้องเนื้อหาได้ที่นี่ ฉันให้โดยมีจุดหยุดในมุมมอนคุณครูแต่พอกลับมา เรื่องนี้ฉันต้องลดทุกอย่างจะเรียบง่าย Textbox และ Textblock นที่ปิดการแสดงเดียวกับข้อมูลแต่พวกเขาไม่สามารถทำได้ พวกเขาไม่มีอะไรแสดงถึงแม้หลังจากพิมพ์เข้าไปในกล่องที่บล็อคไม่ได้รับข่าวคืบหน้า แต่สิ่งที่ฉันเคยพยายามที่ Databinding ไม่ทำงาน มีใครมีไอเดีย?
ขอบคุณล่วงหน้า
ครั้งที่สองมุมมอง
<Window x:Class="AoE4_BO_Overlay.Views.EditorView"
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:local="clr-namespace:AoE4_BO_Overlay.Views" xmlns:viewmodels="clr-namespace:AoE4_BO_Overlay.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:EditorViewModel}"
mc:Ignorable="d"
Title="EditorView" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<TextBlock Text="{Binding Path=FirstName}" Grid.Column="0" Grid.Row="2"/>
<TextBox Text="{Binding Path=FirstName , Mode=OneWay}" Grid.Column="0" Grid.Row="1"/>
</Grid>
ฉัน ViewModel
internal class EditorViewModel : Conductor<object>
{
private string _firstName = "Tom";
public EditorViewModel()
{
}
public string FirstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
NotifyOfPropertyChange(() => FirstName);
}
}
}
ยังไงผมเรียกทั้งสองของพวกเขา
public void CreateBO_Click(object sender, RoutedEventArgs e)
{
EditorView createBO = new EditorView();
ActivateItemAsync(new EditorViewModel());
createBO.Show();
}
เพิ่มข้อมูล
public partial class EditorView : Window
{
public EditorView()
{
DataContext = new EditorViewModel();
InitializeComponent();
}
}