ठीक है, मैं एक ग्रिड सेल के अंदर एक ContentPresenter है:सामग्री प्रदाता ग्रिड सेल क्यों भरता नहीं है?
<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>
ContentPresenter जो यूआई तत्व DataTemplate संसाधनों के तहत परिभाषित द्वारा उपयोग करने के लिए ढूँढता है:
<DataTemplate DataType="{x:Type ViewModels:RatedValuesViewModel}">
<Views:RatedValuesView />
</DataTemplate>
अब, सब कुछ, उम्मीद से काम करता है के रूप में के अलावा एक बात: रनटाइम पर सामग्री प्रस्तुतकर्ता के अंदर जो दृश्य रखा गया है वह पूरे सेल को भरने के लिए विस्तारित नहीं होता है। यह बाएं और दाएं तरफ एक बड़ा मार्जिन छोड़ देता है।
सामग्री प्रस्तुतकर्ता के अंदर दृश्य को मैं पूरे उपलब्ध क्षेत्र को कैसे भर सकता हूं?
सुनिश्चित करें कि दृश्य पर कोई स्पष्ट/निहित आकार की बाधाएं नहीं हैं। – devios1