这可能是我所缺少的简单东西。我有一个png文件,我想将其用作WPF窗口中* 图像 *控件的源。我通过Project Properties> Resources> Add Existing File添加了该PNG文件,然后首先将其作为链接文件添加(然后在它不起作用时嵌入其中)。然后在此为XAML文件中的图像控件添加* Source *。无需代码,只需单击即可。
烦人的问题是,当我设计WPF窗口时,图像会显示出来。当我运行它时,它没有。什么也没出现。
更新:下面添加了XAML代码
<Window x:Class="Server.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SERVER" Height="467.91" Width="620.522">
<Grid>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF080C59" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Grid.Background>
<Button x:Name="btnConnect" Content="Connect" HorizontalAlignment="Left" Height="30" Margin="425,34,0,0" VerticalAlignment="Top" Width="134" Click="btnConnect_Click"/>
<Button x:Name="btnDisconnect" Content="Disconnect" HorizontalAlignment="Left" Height="35" Margin="425,69,0,0" VerticalAlignment="Top" Width="134" Click="btnDisconnect_Click"/>
<TextBlock x:Name="txtLog" HorizontalAlignment="Left" Margin="416,160,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="161" Width="87" Background="#FFFFF5F5" Text="LOG:"/>
<TextBox x:Name="txtMsg" HorizontalAlignment="Left" Height="23" Margin="416,326,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="112"/>
<Button x:Name="btnSend" Content="Send" HorizontalAlignment="Left" Height="35" Margin="425,120,0,0" VerticalAlignment="Top" Width="134" Click="btnSend_Click"/>
<ListView x:Name="lsvClients" Height="67" Margin="46,212,260,0" VerticalAlignment="Top">
<ListView.View>
<GridView>
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
我想念什么?谢谢
翻阅古今
斯蒂芬大帝
喵喵时光机
相关分类