測試我的應用程序與不同的屏幕不同的電腦,我的佈局看起來不錯,但是當我在另一臺PC上啓動我的應用程序的某些控件取代網格:某些控件在網格取代WPF
在其他PC:itemscontrols的
代碼(位移):
<ItemsControl Name="itClblMenge" Height="37" ItemsSource="{Binding ArtikelInfo}" VerticalContentAlignment="Center" BorderThickness="1" BorderBrush="Black" Margin="309,37,81,46" Grid.Column="1" SnapsToDevicePixels="True">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="37" >
<Label x:Name="lblMenge" >
<Label.Content>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="}{0} {1}">
<Binding Path="RawQuantity"/>
<Binding Path="QuantityUnit"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Label.Content>
</Label>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
有人對此有解釋嗎?
您應該在放置ItemsControl的位置顯示父面板而不是ItemsControl本身,因爲它無助於解決問題。順便說一句,在'ItemTemplate'中有很多冗餘元素:** 1)**'Grid'沒有用處,因爲它包含一個元素** 2)**您不需要'Label',使用'TextBlock'只要。 – Maxim
我得到了網格中的itemscontrols,哦謝謝你的反對。 –