How do I set the Panorama App Title of a Page as an Image and not a string of text? I have added:
<phone:Panorama>
<phone:Panorama.Background>
<ImageBrush ImageSource="\Assets\image-logo-small.png"/>
</phone:Panorama.Background>
......
However this sets the entire background as the image selected.
Any idea how I can replace the <phone:Panorama Title="Text"> with an Image?
StackOverflow already has similar case in windows 7, Setting image as Panorama Title for Panorama page in wp7
In our case try these
<phone:Panorama >
<phone:Panorama.TitleTemplate>
<DataTemplate>
<StackPanel>
...........
</StackPanel>
</DataTemplate>
</phone:Panorama.TitleTemplate>
..........................
</phone:Panorama >
The following code successfully places an image within Title section of a Panorama App:
<phone:Panorama>
<phone:Panorama.Title>
<Grid Margin="0,80,0,0">
<Image Source="\images\MyImage.png"
HorizontalAlignment="Center"
Width="400" Height="50" />
</Grid>
</phone:Panorama.Title>
....
Try this, for wp8:
<phone:Panorama.TitleTemplate>
<DataTemplate>
<Grid>
<Image Source="/Assets/logo.png">
</Image>
</Grid>
</DataTemplate>
</phone:Panorama.TitleTemplate>
Have fun!!!
Related
I have a simple page that is supposed to display an image. On my android app it fits to the phone screen, but on my UWP app running on a laptop the image expands out of the window. I have tried all different aspect options and different Horizontal and Vertical Orientation options with no luck.
My page looks like this:
<ContentPage.Content>
<StackLayout >
<StackLayout VerticalOptions="Center" >
<Image Aspect="AspectFit" Source="{Binding ImageSource, Converter={StaticResource LocalByteToImageFieldConverter}}" />
</StackLayout>
</StackLayout>
</ContentPage.Content>
And the output looks like this:
Android:
UWP:
I'm guessing its something small I'm missing but cannot find the right style settings.
try this , may be helpful for you
<Grid VerticalOptions="Fill" HorizontalOption="Fill" >
<Image Aspect="AspectFit" Source="{Binding ImageSource,
Converter={StaticResource LocalByteToImageFieldConverter}}" />
</Grid>
try use Image Source="aa.jpg" Aspect="AspectFill"
I am developing UWP application, to showing loading process i am using a Custom GIF image as usercontrol. I am adding this GIF image user control to a grid like below.
But while running the GIF it hangs some time..But when i use ProgressRing control it is running perfect.
<Grid
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="ProcessingGrid"
Visibility="{x:Bind VM.IsProcessing ,Mode=TwoWay,Converter={StaticResource BooleanToVisibilityConverter}}">
</Grid>
This is my Usercontrol
<Grid
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.3">
</SolidColorBrush>
</Grid.Background>
<Image x:Name="loadingGif" Source="ms-appx:///Assets/GifAssets/ADProcessingIcon.gif"
Width="80">
</Image>
</Grid>
try using "XamlAnimatedGif" library
<page
....
xmlns:gif="using:XamlAnimatedGif"/>
...
<Image x:Name="imgLoading"
gif:AnimationBehavior.SourceUri="/Assets/GifAssets/ADProcessingIcon.gif"/>
...
I'd like to add text on WindowsPhone 8.1 MediaElement fullscreen mode, but I cannot get it visible.
Here is my code:
<Grid>
<MediaElement Name="MyMedia" IsFullWindow="True" MarkerReached="MyMedia_MarkerReached"/>
<TextBlock x:Name="MediaTitles" Text="Hello World" HorizontalAlignment="Left" Margin="55,240,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="99" Width="270" FontSize="48" />
</Grid>
Any ideas what I'm doing wrong?
The property IsFullWindow="True" is causing the problem. As you might know by now. If I want the media element full screen I usually add it to the grid and span across 1 for column and row. Something like below:
<MediaElement
Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="1"
Grid.ColumnSpan="1" />
This gives the same effect as full screen on the device. And you can see your Hello world text in the Designer.
I'm using Panorama Control, and have image on the top. My XAML code as follow:
<Grid x:Name="LayoutRoot">
<Image Grid.Row="0" Source="/Images/khuyenmai.png" Height="85" Width="85" HorizontalAlignment="Right" x:Name="imgKhuyenMai" Tap="imgKhuyenMai_Tap" VerticalAlignment="Top" Margin="305,5,41,0" RenderTransformOrigin="2.205,-6.523"></Image>
<phone:Panorama Grid.RowSpan="2" Margin="0,0,0,10">
<!--Panorama item one-->
<phone:PanoramaItem Header="item1">
<Grid/>
</phone:PanoramaItem>
<!--Panorama item two-->
<phone:PanoramaItem Header="item2">
<Grid/>
</phone:PanoramaItem>
</phone:Panorama>
</Grid>
My problem is : "Tap" event is not working ?
In Grid, when Canvas.ZIndex of items is equal, the latter item will cover the ahead item. For example, in your code, Panorama will cover Image item, So you can't Tap it. There are 2 solutions, you can choose one:
set Canvas.ZIndex = 1 on Image
OR
change sort of your code like this, put Image latter than Panorama:
<Grid x:Name="LayoutRoot">
<phone:Panorama/>
<Image/>
</Grid>
I have such DataTemplate:
<DataTemplate x:Name="GreenMarkTemplate">
<Grid Width="64" Height="64">
<Image Source="Assets/Marks/mark_green.png" RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="{Binding course}" />
</Image.RenderTransform>
</Image>
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="{Binding route_num}" VerticalAlignment="Center" FontSize="16"/>
</Grid>
</DataTemplate>
And I need to rotate Image according to "course" property. At first, Image shows with zero angle and in a moment it rotates. This makes Image blinking.
So, is it possible somehow to make Image invisible and show it only after rotation? or rotate image before rendering it?
Resolved the issue using LayoutTransform port for Windows Phone 8. github link