Ok Tôi có một ContentPresenter bên trong một tế bào lưới:Tại sao nội dung không điền vào ô lưới?
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<WrapPanel Grid.Row="0" Grid.Column="0">
<RadioButton GroupName="a" IsChecked="{Binding Path=SpecifyRatedValues, Mode=TwoWay}">Specify</RadioButton>
<RadioButton GroupName="b" IsChecked="{Binding Path=SpecifyRatedValues, Converter={StaticResource invertBoolean}}">Auto generate</RadioButton>
</WrapPanel>
<Border BorderBrush="Black" BorderThickness="3" Grid.Row="1" Grid.Column="0">
<ContentPresenter Content="{Binding Path=RatedValues}"></ContentPresenter>
</Border>
</Grid>
Các ContentPresenter thấy mà UI yếu tố để sử dụng bởi các datatemplate xác định theo nguồn:
<DataTemplate DataType="{x:Type ViewModels:RatedValuesViewModel}">
<Views:RatedValuesView />
</DataTemplate>
Bây giờ, mọi thứ hoạt động như mong đợi, ngoại trừ một điều: Chế độ xem được đặt bên trong contentpresenter trong thời gian chạy không mở rộng để lấp đầy toàn bộ ô. Nó để lại một lề lớn ở bên trái và bên phải.
Tôi làm cách nào để chế độ xem bên trong contentpresenter lấp đầy toàn bộ khu vực có sẵn?
Đảm bảo không có ràng buộc kích thước rõ ràng/ẩn trong chính chế độ xem. – devios1