2017-07-03 84 views
0

測試我的應用程序與不同的屏幕不同的電腦,我的佈局看起來不錯,但是當我在另一臺PC上啓動我的應用程序的某些控件取代網格:某些控件在網格取代WPF

@my PC其中i它下發展: enter image description here

在其他PC:itemscontrols的

enter image description here

代碼(位移):

<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> 

有人對此有解釋嗎?

+0

您應該在放置ItemsControl的位置顯示父面板而不是ItemsControl本身,因爲它無助於解決問題。順便說一句,在'ItemTemplate'中有很多冗餘元素:** 1)**'Grid'沒有用處,因爲它包含一個元素** 2)**您不需要'Label',使用'TextBlock'只要。 – Maxim

+0

我得到了網格中的itemscontrols,哦謝謝你的反對。 –

回答

0

我以前見過類似的問題。在舊版XP機器上運行Windows 7 WPF應用程序。我想象構建NET 4.7應用程序可能會在Windows 7機器上產生抖動。

  1. 檢查NET框架安裝在兩臺機器上,和你的建築對
  2. 什麼版本的Windows的每個運行?
  3. 如何在其他機器上安裝應用程序?如果您發現機器存在差異,請考慮使用ClickOnce來嘗試並滿足軟件要求 - 如果更新其他計算機需要大量人力。
+0

我使用.net 4.0,在另一臺機器上測試也具有.net和相同的窗口只是另一個屏幕,它取代了.... –

+0

@JulPod爲什麼你使用這樣一箇舊版本的.NET? – wonea