Đối với một dự án tôi đang sử dụng XAML. Tôi đã lệch màn hình của mình ở các phần khác nhau. Khoảnh khắc khi tôi thêm nút, tôi gặp lỗi.XAML Các yếu tố bất động sản
Lỗi:
'property elements cannot be in the middle of an element's content'
Mã Tôi đang sử dụng cho nút nơi lỗi đã được tìm thấy:
<Button x:Name="cntButton" Content="Connect" Grid.Column="1" Grid.Row="2" Click="cntButton_Click" />
Có ai biết vấn đề là gì và làm thế nào tôi có để giải quyết nó ?
Phần còn lại của các mã:
<Window x:Class="Pesten.View.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Image Grid.RowSpan="4" Grid.ColumnSpan="3" Stretch="Fill" Source="pestenbg.jpg" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Button x:Name="cntButton" Content="Connect" Grid.Column="1" Grid.Row="2" Click="cntButton_Click" />
</Grid>
</Window>
Bạn có thể hiển thị phần còn lại của tệp XAML không? – BenjaminPaul
Phần tử Nút chính nó có vẻ ổn. Bạn có thể đăng thêm XAML không? Có lẽ toàn bộ nó? –
có thể trùng lặp với [Lỗi WPF: Các phần tử thuộc tính không thể ở giữa nội dung của phần tử. Họ phải ở trước hoặc sau nội dung] (http://stackoverflow.com/questions/26524787/wpf-error-property-elements-cannot-be-in-the-middle-of-an-elements-content-th) – Dzyann