I want to show a placeholder static image in my Windows Phone 8.1 app while loading an image asynchronously from the web.
<Image Name="productImage" Source="{Binding ImgUrl}" />
The Image is inside a ListView in a DataTemplate.
How to know if the Image finished loading, so I can hide the static Image?
If Performance isn't too critical, you can just place two images on top of each other:
<Grid>
<Image Source="The Background Image" />
<Image Source="{Binding ImageUrl}" />
</Grid>
Your downloaded Image will just overlay the background, once it has loaded.
Will only look fine if your images have a fixed size.
Related
So I have a Button where I want to add an image, but the app is crashing when the view gets loaded (view doesn't even show up, using Xamarin Live Player). If I create an extra image field the image shows up.
Here is the code:
<Image Grid.Row="3" Source="trash.png"></Image>
<Button Grid.Row="4" Image="trash.png" ></Button>
Any ideas why?
I am trying to create a user interface where a user can drag an image around the screen atop a background image. Currently the DraggableImage is being moved around with some sliders that change DraggableBounds in the view model.
<AbsoluteLayout>
<Image Source="{Binding DraggableImage, Mode=TwoWay}" AbsoluteLayout.LayoutBounds="{Binding DraggableBounds}" />
<Image Source="{Binding FrameImage, Mode=TwoWay}" Aspect="AspectFit" WidthRequest="1300" HeightRequest="500"/>
</AbsoluteLayout>
I've tried using the Pan Gesture that's on Microsofts Xamarin docs with little success. I'm not trying to pan within an image but move a smaller image over a larger. Is there an existing pattern to solve this?
I just completed the course on template 10 in mva. Now I am working on this app and would like it to have the splash screen like this(of course the logo can be changed). Where should I get started to code(any tutorial)? Or if there's a sample code available.
Screenshots:
I think it uses an extended splash screen. The extended splash screen in UWP is the same as it in a Windows 8.1 app. You can start with How to extend the splash screen (XAML), there is a 8.1 sample in this document, and you can also refer to the official UWP Splash screen sample.
And from your picture, there is a circular ProgressBar, to create such a PrgressBar, there are several methods, for example here you can refer to [UWP] - Circular Progress Bar.
Update:
It's quite easy, downloaded your posted project in the comment, there is a usercontrol named "RoundProgressControl", in this usercontrol, you can put a Image inside it like this:
<Grid x:Name="TheGrid" Width="28" Height="28" Margin="0,0,0,0" Background="Transparent">
<Path x:Name="ThePath" Fill="Transparent" Stroke="#ff999999" StrokeThickness="4" StrokeDashCap="Flat">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="12,24" x:Name="ThePathFigure">
<PathFigure.Segments>
<PathSegmentCollection>
<ArcSegment x:Name="TheSegment" Size="12,12" IsLargeArc="False" SweepDirection="Clockwise" Point="12,24" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<Image Source="Assets/E1.png" Width="30" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
I put a image source named "E1.png" in the Assets folder of the project, you can replace it with your own image. You can also modify the size of the Image by setting the Width and Height property.
I'm currently developing a Windows Phone application.
I have a view with a button in which I would like to set an image.
I found a lot of solution through Internet but it still not work.
Actually, it works when I put an URL from the Internet. The image is well displayed on the button but when it's from my resources folder, no image is loaded.
Here is my XAML code to do that :
<Button Grid.Row="1" Command="{Binding ShowSearchFilterCommand}" Height="100" Width="100">
<StackPanel>
<Image Source="resources/SearchFilterIcon.png" />
</StackPanel>
</Button>
I set the build action of my image to "Content". The designer display the image so I don't understand what I did wrong.
You have to set the correct path to your image source as in a way /FolderName/ImageName.png.
If the images are placed inside nested folders set like this
Source="/FirstFolderName/SecondFolderName/.../ImageName.Extnsion"
Try this:
<Button>
<ItemsControl>
<Image Source="/Assets/images/ImageName.png"></Image>
</ItemsControl>
</Button>
I am trying to create a simple image viewer in silverlight.
my code is this:
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="0" Padding="0" Width="300" Height="300">
<Canvas Width="600" Height="400" Margin="0">
<Image Source="/MapViewer;component/Images/imageFileName.jpg" Stretch="None" Margin="0,0,90,5"></Image>
</Canvas>
</ScrollViewer>
(I used the Canvas because in the future I would like to paint more fixed elements on the image, such as lines, polylines, etc)
This code is working ok except the fact that the ScrollViewer cuts the image: say the image is 800x600, than I can view around 700x500. I dont know if that was clear enough, so I will add a picture:
(this is the original image)
(and this is the picture, as viewed in my application)
As you can see, I cannot view the bottom right corner of the image... can somebody please tell me how to fix this?
It is not the scroll viewer cropping your image, it is the fixed-size canvas where you placed it. If you want your entire image to be visible you need to set the canvas size to be exactly the same size as your image.