I'm creating a very UI centric application - in this application it is important (or event vital one can say) that I can actively preview my changes. Thankfully, Xamarin.Forms has Hot Reload - the perfect tool to get started to preview your changes!
I enabled hot reload in the 'Hot Reload' section in the options tab - I also enabled the 'Changes Made' (which is in preview) option to 'ON'.
I started my application - and I changed the text of a button... And...
Nothing.
I closed and reopened my app - and tried again... And... guess what?
Nothing.
Xamarin.Forms - come on!
This is a very annoying issue I've had on this specific application - it's taken away most of my day and I've just been fighting and fighting - and I have been unable to solve anything.
What I tried to do:
I tried to upgrade my Xamarin.Forms version to the latest - and that still did not solve anything.
I tried to enable and disable Hot Reload from the options menu - and that still did not solve anything.
I tried to close and reopen the solution - clean - and build - and you guess it: still I could not preview my changes.
I checked if I enabled it and it was enabled.
I checked my linker settings and they were as expected.
Images:
XAML code:
I changed the background color to blue:
<Grid HeightRequest="100"
Margin="5"
BackgroundColor="White"
RowSpacing="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0"
Grid.Column="1"
TextColor="Blue"
VerticalOptions="Center"
Text="{Binding EventTitle}"
Margin="7"
Padding="10,0" />
<Image Grid.Row="0"
HeightRequest="125"
VerticalOptions="Start"
Margin="2,2,1,2"
Aspect="AspectFill"
Source="{Binding Image}" />
</Grid>
My phone:
Even after saving - and waiting for at least half an hour - still the background is white.
I've tried everything possible to get it to work and I've been hitting the wall each time.
I am looking for help,
Thanks,
Tom
I've had all sorts of different issues with Hot Reload not working over the past few months.
I found the only consistent way that I could get it to work was by opening the project the long way around.
So:
Open Visual Studio
Choose Continue without code on the startup screen
Go to File -> Open -> Project/Solution and choose the solution from there.
Whenever I load the project this way, Hot Reload will work. If I load it any other way, it seems to be really temperamental.
Open project
Go to Tools => Debugging => Hot Reload
On "Common" section tick "Apply XAML hot reload on document save"
on "Xamarin.Forms" section tick "Full Page"
as shown in the image (red circled below).
On a project had the same issue , found out that i have to be in a XAML page
and not a XAML.CS page
Then hit save and it starts again and oke.
Common options - only Enable Just My XAML in Live Visual Tree
And in Xamarin.Forms option -Full page
ps
On your example it is White
BackgroundColor="White"
Related
Im following allong the Youtube Series "Beyond Monkey" and on part 8, my XAML wont render at runtime (project compiles fine), hitting an error:
A cycle occurred while laying out the GUI.
Ive literally copied and pasted the code from the github repo to check its correct, but it still doesn't like it. I've pulled out bits of XAML everywhere until it builds and it seems it doesn't like the icon XAML:
<!-- Likes -->
<HorizontalStackLayout
Spacing="6"
VerticalOptions="Center">
<Image
Source="imglike.png"
WidthRequest="16"
HeightRequest="16" />
<Label
Style="{StaticResource RegularLightText14}"
Text="{Binding TheVideo.LikesCount, Mode=OneWay}" />
</HorizontalStackLayout>
If I strip the image and label out of the Horizontal Stack Layout it works, but as soon as I try to add any content to them, app.g.i.cs blows up with an unhandled exception
A cycle occurred while laying out the GUI.
Layout cycle detected. Layout could not complete.
The XAML looks ok to me and obviously works for the author, so I'm guessing is something unrelated that a XAML n00b like myself doesn't understand.
Anyone have any ideas?
Thanks
I have portable library in which I have AppLocalizations.resw resource files. I can read it in the code behind (which is obsolete, but working):
new Windows.ApplicationModel.Resources.ResourceLoader("Assembly/AppLocalizations")
But how can I use it from the xaml? When I try to read it this way, the text is blank, even if the key in the resource file is Key.Text
<TextBlock x:Uid="Key" />
I was triying to import it in the App.xaml, but with no success.
Thanks.
I use this code with Windows Phone Universal Apps, but with a general resources:
<TextBlock Style="{StaticResource TextBlock_BlackStyle}" x:Uid="/Resources/txtIPName" Name="txtIPName" HorizontalAlignment="Left" Margin="33,149,0,0" TextWrapping="Wrap" Text="IP:" VerticalAlignment="Top"/>
Then if u had exertanl library, I think the code is:
<TextBlock x:Uid="/Assembly/AppLocalizations/Key" />
Tell me if I solve your problem! Good luck man! :)
I'm new to developing Windows 8 apps, and am having trouble getting my XAML file to recognise generated code for adding AppBars and CommandBars.
I am getting the error "Unknown type [something] in XML namespace" for a number of elements I am trying to add, here is my example below:
If I re-open my solution this is temporarily displayed as a warning rather than an error. Also navigating to http://schemas.microsoft.com/winfx/2006/xaml/presentation just produces "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.".
This is all default code. my class namespace (e.g. MyApp.MainPage) matches the MainPage code behind namespace. I am at a loss and have been battling this for hours. I also intermittently changes from this error to 'InitializeComponent' does not exist in the current context". I have spent hours on XAML permissions errors in the past few days and don't want to waste any more time with errors in default generated code! :(
EDIT: I have tried this on three different machines, using both Windows 8 and Windows 8.1, both new projects and the existing project I have described in this post.
My guess is that you are using Visual Studio 2012 (Windows 8 apps). If so, you should use Button:
<Page.TopAppBar>
<AppBar>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource AppBarButtonStyle}">A</Button>
<Button Style="{StaticResource AppBarButtonStyle}">B</Button>
</StackPanel>
</AppBar>
</Page.TopAppBar>
To use AppBarButton, you must use Visual Studio 2013 (Windows 8.1 apps):
<Page.TopAppBar>
<AppBar>
<StackPanel Orientation="Horizontal">
<AppBarButton>
<AppBarButton.Icon>
<FontIcon Glyph="A"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton>
<AppBarButton.Icon>
<FontIcon Glyph="B"/>
</AppBarButton.Icon>
</AppBarButton>
</StackPanel>
</AppBar>
</Page.TopAppBar>
Also, CommandBars are only available in Windows 8.1.
I'm using Player Framework in my windows store app
http://playerframework.codeplex.com/
I want to use it only for audio files (no vide). Now I want that when user starts the track the bar with seeker, pause/play, volume is visible. I achived that when you move mouse over it and it will be shown it won't vanish. But I need to show it on start. How can i do that ?
It looks like this in my app
<mmppf:MediaPlayer Name="TrackPlayer" Width="400" Height="50" AudioCategory="BackgroundCapableMedia" AutoHideBehavior="None" IsDurationVisible="True" AutoHide="False" />
Just set IsInteractive="True":
<mmppf:MediaPlayer Name="TrackPlayer" Width="400" Height="50" AudioCategory="BackgroundCapableMedia" IsInteractive="True" IsDurationVisible="True" AutoHide="False" />
I've Been working with WP7 for a while, am using listPicker/DatePicker Heavily. i hate its design though.i use liskPicker's property ExpansionMode="FullScreenOnly". i tried to make those controls to look prettier by
// Setting A source to the FullModeItemTemplate
FullModeItemTemplate="{StaticResource lpkFullItemTemplate}"
//the definition for this Resource is as follows:
<DataTemplate x:Name="lpkFullItemTemplate">
<StackPanel Orientation="Horizontal" Margin="5 5 5 5" Background="#FFA3A3A3"
Width="475" Height="45" >
<TextBlock Text="{Binding}" Foreground="Black" Margin="5 5 15 5" />
</StackPanel>
</DataTemplate>
I need real changes, changing the background of that popup and such changes, is that possible? or i need to build my own popup from scratch?
In order to do that you will have to create a copy of the ListPickerPage.xaml file from the Silverlight for Windows Phone Toolkit in your application, change it to meet your requirements, and then on your ListPicker control set the PickerPageUri proprety to the new ListPickerPage.xaml
I would like to improve Pedro's answer, but I still can't comment. You can see there's some people making questions up there.
In order to copy the ListPickerPage you'll need both the ListPickerPage.xaml and ListPickerPage.xaml.cs files. If you want those files to compile, you need some extension methods defined on Extensions.cs, ItemsControlExtensions.cs and VisualTreeExtensions.cs. You can either copy those three files or cherry pick the methods you need and add them to your own file.