簡體   English   中英

在WPF中使用XAML和ironpython,圖像顯示在設計器窗口中,但當我運行程序時不顯示

[英]Using XAML and ironpython in WPF, image shows in designer window but not when I run the program

我正在為一個學校的項目工作,我對Ironpython非常了解。 我正在嘗試處理幾個圖像。 我希望能夠使用鼠標拖動它們,但是在運行程序時,我什至無法將圖像顯示在表單上。 它在設計器內部顯示得很好,並且在我運行程序后消失了。

到目前為止,這是我的代碼...

<Window 
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
       Title="WpfApplication3" Height="1000" Width="1000" Background="Green"> 
       <Grid>

        <Button Width="75" Height="50" Click="Button_Click">Push Me</Button>
        <Image  HorizontalAlignment="Left" Height="100" Margin="289,460,0,0" VerticalAlignment="Top" Width="100">
            <Image.Source>
                <BitmapImage UriSource="/Images/atlantafalcons.jpg" />
            </Image.Source>
        </Image>
    </Grid>
</Window> 

我不明白我在做什么錯...

只需刪除第一個反斜杠:

<Grid>
    <Button Width="75" Height="50" Click="Button_Click">Push Me</Button>
    <Image  HorizontalAlignment="Left" Height="100" Margin="289,460,0,0" VerticalAlignment="Top" Width="100">
        <Image.Source>               
            <BitmapImage UriSource="Images/atlantafalcons.jpg" />
        </Image.Source>
    </Image>
</Grid>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM