图像刷不工作Windows Phone 8.1

时间:2016-01-28 13:48:13

标签: .net xaml windows-runtime windows-phone-8.1

我的xaml代码

   <Grid Background="White">
    <StackPanel Height="580" Margin="0,0,0,50" Orientation="Vertical">
        <Image Height="70" Width="100" HorizontalAlignment="Center"/>
        <Image Height="50" Width="300" HorizontalAlignment="Center"/>
        <Ellipse x:Name="imgProfile" Height="180" Width="180"  Visibility="Visible"  >
            <Ellipse.Fill>
                <ImageBrush ImageSource="/IOB Wallet/Images/Profile/photo.png" Stretch="UniformToFill" />
            </Ellipse.Fill>
        </Ellipse>
        <TextBlock Height="40" Text="Welcome Back !!!" Foreground="#06419D" FontSize="30" FontWeight="SemiBold" TextAlignment="Center" Margin="4"/>
        <TextBlock Height="40" Text="" Foreground="Black" FontSize="28" FontWeight="SemiBold" TextAlignment="Center" Margin="4"/>
        <TextBlock Height="30" Text="" Foreground="Black" FontSize="24" FontWeight="Normal" TextAlignment="Center" Margin="4"/>
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="If you are Not ?" Foreground="Black" FontSize="15" HorizontalAlignment="Center" Margin="75,10,0,0"/>
            <HyperlinkButton Content="Change User" Foreground="#06419D" FontSize="20" Margin="20,0,0,0"/>
        </StackPanel>
        <PasswordBox Height="40" PlaceholderText=" Password"  BorderThickness="0 0 0 1" BorderBrush="#06419D" Margin="4,0,2,0"/>
        <HyperlinkButton Foreground="#06419D" FontWeight="Light" Visibility="Visible" Content="Forgot Your Password ?" FontSize="20" HorizontalAlignment="Right" Width="234" />

    </StackPanel>
    <Button Content="LOGIN" Name="btnGetstarted" FontSize="26" FontWeight="Light" VerticalAlignment="Bottom" Foreground="White" Margin="1,0,0,-8" BorderThickness="0" Background="#06419D" Height="56" Width="500" Click="btnLogin_Click"  />

图像在Xaml设计视图中是可访问的。运行/部署应用程序后,图像不显示。我的相片实际尺寸100 * 100 .. 请建议解决方案

2 个答案:

答案 0 :(得分:1)

<Ellipse x:Name="imgProfile" Height="180" Width="180"  Visibility="Visible"  >
            <Ellipse.Fill>
                <ImageBrush ImageSource="ms-appx:///IOB Wallet/Images/Profile/photo.png"  />
            </Ellipse.Fill>
</Ellipse>

试试此代码

答案 1 :(得分:0)

您应该尝试通过“属性”窗口设置背景。在XAML代码中单击Ellipse标记内部,然后按F4键以打开“属性”窗口。展开画笔项目,然后选择平铺画笔。从下拉菜单中选择ImageSource

enter image description here