I need a date picker that shows only month and year...
how to implement this...any NugGet package is available...?
Thanks in advance..
Date picker shows only month and year
Problem with OnPlatform and UWP
HI guys,
I have a problem with OnPlatform
.
<ToolbarItem x:Name="toolbarSave" Command="{Binding SaveWord}" Order="Primary" Priority="0" Text="Save">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource" UWP="Images/Save.png" />
</ToolbarItem.Icon>
</ToolbarItem>
The Xamarin.Forms
version I'm using is 2.5.0.121934
At Runtime I receive the following error
Cannot assign property "UWP": Property does not exists, or is not assignable, or mismatching type between value and property
Two listview MVVM
Hello, in my project I use two listview on the same page and I use MVVM. On Android side everything is ok but in iOS part application is slow. If I click list items waits too much and than action happens. I have one PropertyHandler, I tried with two PropertyHandler but nothing changed.
How to specify the path to an inner property of a resource in xaml?
I have a composite object stored as a global resource and I would like to access to one of its property in xaml.
I tried to do that:
<ResourceDictionary>
<models:ColorPair x:Key="myColorPair" x:FactoryMethod="FromHex">
<x:Arguments>
<x:String>#fea70a</x:String>
<x:String>#fea70a</x:String>
</x:Arguments>
</models:ColorPair>
...
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="BackgroundColor" Value="{StaticResource myColorPair.BackgroundColor}" />
<Setter Property="TextColor" Value="{StaticResource myColorPair.ForegroundColor}" />
</Style>
<!-- Application resource dictionary -->
</ResourceDictionary>
But I got an exception: Exception thrown: 'Xamarin.Forms.Xaml.XamlParseException', Message: Position ##:##. StaticResource not found for key myColorPair.BackgroundColor
Is that possible?
How to use a server?
I wrote a xamarin.forms App with iOS, UWP, Android and PCL Projects. And I have an Ubuntu Server stationed somewhere else, that I can access via ssh.
I have no experience in working with a server. So my question is, what do I still need to do, to use the Server to simply send a request and get a response for example? Or what do I need, to make a User Authetication possible?
(If its possible, I would like to use GraphQL instead of REST)
Why my app crash after scrolling ListView with SubItems
XAML CODE:
<ListView.Header>
<Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
</Grid.RowDefinitions>
<Image Source="icon.png"
Grid.Column="0" VerticalOptions="FillAndExpand"
Grid.Row="1"/>
<Label Grid.Column="1" Grid.Row="1" TextColor="White"
x:Name="lblUser" FontSize="26" FontAttributes="Bold"
Text="Usurio" VerticalOptions="Start"/>
<Label Grid.Column="1" Grid.Row="1" TextColor="White"
FontSize="16" Text="correoelectronico@correo.com"
VerticalOptions="End"/>
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
<ListView x:Name="ItemsListView"
SeparatorVisibility="None"
HasUnevenRows="true"
ItemsSource="{Binding Items}">
<ListView.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Image Source="{Binding ImageHeader}"
Grid.Column="0" Grid.Row="0"/>
<Label VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
Text="{Binding TitleHeader}"
FontSize="24"
Grid.Column="1" Grid.Row="0"/>
<Image Source="ic_arrow_down.png"
Grid.Column="2" Grid.Row="0"/>
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Margin="20,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Image Source="{Binding Image}"
Grid.Column="0" Grid.Row="0"/>
<Label VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
Text="{Binding Title}"
FontSize="18"
Grid.Column="1" Grid.Row="0"/>
<Image Source="ic_arrow_down.png"
Grid.Column="2" Grid.Row="0"/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
CS CODE:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class HomeMaster : ContentPage
{
public ListView ListView;
public HomeMaster()
{
InitializeComponent();
BindingContext = new HomeMasterViewModel();
ListView = MenuItemsListView;
}
class HomeMasterViewModel : INotifyPropertyChanged
{
public ObservableCollection<HomeMenuItem> MenuItems { get; set; }
public HomeMasterViewModel()
{
MenuItems = new ObservableCollection<HomeMenuItem>(new[]
{
new HomeMenuItem ("Page 1", "ic_monetization.png",new ObservableCollection<Item> {
new Item("Item 1", "ic_help.png", null), new Item("Item 2", "ic_help.png", null)} ),
new HomeMenuItem ("Page 2", "ic_monetization.png",new ObservableCollection<Item> {
new Item("Item 1", "ic_help.png", null), new Item("Item 2", "ic_help.png", null)} ),
new HomeMenuItem ("Page 3", "ic_monetization.png",new ObservableCollection<Item> {
new Item("Item 1", "ic_help.png", null), new Item("Item 2", "ic_help.png", null)} ),
});
}
#region INotifyPropertyChanged Implementation
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged == null)
return;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}
OnPlatform x:TypeArguments in CommandParameter
Hi All,
I'm new to Xamarin forms. I need your help to resolve this, want to passed a CommandParameter based on Platform, where the value is a string taken from Text property of an Editor.
<BoxView.GestureRecognizers>
<TapGestureRecognizer.CommandParameter>
</TapGestureRecognizer.CommandParameter>
</BoxView.GestureRecognizers>
I need to know what should be the value for the x:TypeArguments?
Thanks
Nelum
Shared library
I am developing an app that will have a asp.net core 2.0 website as well as Xamarin Forms Android and iOS apps. I need to have a library or dll that can be shared across the Xamarin Forms and asp.net core 2.0 app. I am not going for cross platform with asp.net core, it will be a windows deployment. Can I use a simple .net class library or do I need something else?
Thanks in advance!
How do you setup CI for a .NET Standard Xamarin.Forms solution on VSTS?
Has anyone been successful in this? I've struggled to restore NuGet packages and get the UWP app to build on the server. I'm using .NET Core 2.0.0 with preview version instead of NuGet tool, but still no success.
'System.Exception' in Xamarin.Forms.Xaml.dll
Whenever I try to run my App in Android or UWP, I get the following error message:
Exception thrown: 'System.Exception' in Xamarin.Forms.Xaml.dll
An exception of type 'System.Exception' occurred in Xamarin.Forms.Xaml.dll but was not handled in user code
Expression must end with '}'
This seems to occur, in the XAML.cs file. LoadApplication(new FootballStatsApp.App());.
Any suggestions on how to fix this?
Simplest way to draw a single pixel on Xamarin Forms ContentPage?
Hi,
maybe with SkiaSharp (in Xamarin Forms) @mattleibow?
Or can i detect touch event and draw a BoxView 1x1? (but i hope drawing 500 boxview will decrease app performance?).
I use SignaturePad, but i have to do it in UWP, and this component doesn't support it.
Thank you for any suggest!
Lewix
How to set `RowHeight` for ListView as Platform Specific .
is it possible to set RowHeight
of ListView as Platform Specific ?
i did with this-
<ListView.RowHeight> <OnPlatform x:TypeArguments="x:Double"> <On Platform="iOS" Value="65" /> <On Platform="Android" Value="70" /> </OnPlatform> </ListView.RowHeight>
but i getting below error -
Position 255:22. No property, bindable property, or event found for 'RowHeight
[iOS] Blank screen when navigating to another page
Hi,
We have a Xamarin Forms app, that compiles and runs normally on Android and iOS. Visual Studio Team Services is used for continues integration, which seems to work perfectly: we pull code into certain branches and after a while HockeyApp mails us there is a new version available. The compiling takes place on a Mac. (Mac In Cloud)
After downloading the app via HockeyApp:
- The Android version works as it did before pushing the code to VSTS.
- The iOS version shows a black screen after the initial (login) page.
Why would the iOS version be any different after building it with VSTS?
I've tried the xbuild and MSBuild settings and both result in a different app.
Am I missing something?
General Android File System Confusion - Disappearing files
First, i would like to state I have been these threads:
Here: https://forums.xamarin.com/discussion/comment/13869#Comment_13869
Here: https://forums.xamarin.com/discussion/4878/database-sqlite-net-do-not-persist-between-build-on-monodroid
and
Here: https://forums.xamarin.com/discussion/6990/how-to-correctly-save-and-read-files
I have a section of code which checks for the existence of a .db file in this way:
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string dbPath = Path.Combine(path, filename);
if (!CheckdbVersion(dbPath, dbVersion))
{
DeleteFileIfExists(dbPath);
}
CopyDatabaseIfNotExists(dbPath);
private static void CopyDatabaseIfNotExists(string dbPath)
{
if (!File.Exists(dbPath))
{
using (var br = new BinaryReader(Application.Context.Assets.Open("TSRDB.db")))
{
using (var bw = new BinaryWriter(new FileStream(dbPath, FileMode.Create)))
{
byte[] buffer = new byte[2048];
int length = 0;
while ((length = br.Read(buffer, 0, buffer.Length)) > 0)
{
bw.Write(buffer, 0, length);
}
}
}
}
}
This works perfectly when debugging against an actual Android device (Samsung s5) in this case. I can close, stop, restart, minimize the app etc. and the file is only copied if it hasn't been copied previously or if the dbVersion doesn't match (ignore that piece, it's immaterial to my question). At least, I assumed that's what was happening. But, upon closer inspection of the device, the file never seems to be created on the card or the device storage.
I noticed this after my alpha testers started reporting issues and I discovered this method of doing a file stream to: Environment.SpecialFolder.Personal, does not seem to actually copy a file at all. Which is odd, since I'm also doing a File.Exists(dbPath) later and it comes back as true - exists during debug. In fact, everything seems to work perfectly until the app is installed from the play store, though I'm a little baffled as to why it ever works. The value of dbPath variable ends up being this: /data/user/0/com.myappid/files/TSRDB.db
No folder com.myappid is EVER created. At least, I cannot seem to find it when searching the entire device both external and internal storage at any point in time. What am I missing here?
How to do data-binding between an sqlite database and a listview?
I'm trying to use data-binding to get list of contacts from an sqlite database. So far I've followed the guide on working with databases but my listview isn't displaying any numbers.
How to do data-binding between a sqlite database and a listview?
I have tried using the guide on using local databases and reading the working application (Tasky) source code to get an idea of how i could achieve this but my listview remains empty. This is my code:
This is my model:
public class AppUser
{
[PrimaryKey, AutoIncrement]
public long AppUserId { get; set; }
[MaxLength(255)]
public string Name { get; set; }
[MaxLength(255)]
public string ContactName { get; set; }
public string Password { get; set; }
public string MedicalNumber { get; set; }
public string PoliceNumber { get; set; }
public string FireNumber { get; set; }
public string FamilyNumber { get; set; }
public string CustomTextMessage { get; set; }
}
This is my data access layer
public class AppUserDbConnect
{
static SQLiteAsyncConnection _database;
public AppUserDbConnect(string dbPath)
{
_database = new SQLiteAsyncConnection(dbPath);
_database.CreateTableAsync<AppUser>().Wait();
}
public Task<List<AppUser>> GetItemsAsync()
{
return _database.Table<AppUser>().ToListAsync();
}
public Task<List<AppUser>> GetItemsNotDoneAsync()
{
return _database.QueryAsync<AppUser>("SELECT * FROM [AppUser] WHERE [Done] = 0");
}
public Task<AppUser> GetItemAsync(int id)
{
return _database.Table<AppUser>().Where(i => i.AppUserId == id).FirstOrDefaultAsync();
}
public Task<int> SaveItemAsync(AppUser item)
{
if (item.AppUserId != 0)
{
return _database.UpdateAsync(item);
}
else
{
return _database.InsertAsync(item);
}
}
public Task<int> DeleteItemAsync(AppUser item)
{
return _database.DeleteAsync(item);
}
}
}
This is my view:
<StackLayout>
<Label Text="SETTINGS/MY Numbers" FontSize="30" FontAttributes="Bold"/>
<ListView x:Name="ListOfNumbers" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Label Text="{Binding MedicalNumber}" />
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
And finally the code behind:
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MyNumbersPage : ContentPage
{
public MyNumbersPage ()
{
InitializeComponent( );
BindingContext = new AppUser();
}
protected async override void OnAppearing()
{
base.OnAppearing();
ListOfNumbers.ItemsSource = await App.AppUserDatabase.GetItemsAsync();
}
}
Get screen coordinates from Element for both Android and iOS?
I am trying to write a tutorial overlay, otherwise known as ShowcaseView or Coach Markups or Instructional overlay, component. I can handle the custom renderers and putting overlays on top of both Android and iOS screens. My problem though is knowing where the Elements are in screen coordinates specific to each platform to actually highlight the element. To make coding from the shared code side easy, I wanted to just specify the XF element as input to the tutorial overlay and make the tutorial overlay figure out what that Element's screen coordinates are. That is where I am stuck. Is there a nice way of taking an Element and getting the platform specific screen coordinates?
I tried using AutomationId and then scanning the UI hierarchy looking for that AutomationId (AccessibilityIdentifier in iOS), but it doesn't always work. For example, ToolBarItems do not support AutomationId (on Android at least) so I couldn't use it.
Any suggestions?
Troubles with localization in XAML using MarkupExtension
Hello community,
I have a problem with non working localization in my Xamarin application.
I took the guide developer.xamarin.com/guides/xamarin-forms/advanced/localization/ as template and implemented it like described there.
Unfortunately the TranslateExtension does not work in my MainPage.xaml
I import the namespace as needed (only partial shown):
xmlns:resources="clr-namespace:mealticker.Resources"
That's the way I bind the text to the Label:
Label Text="{Binding resources:Translate Username}"
When running the program, nothing is shown in the Label.
The long version described in the article is not compilable:
Label Text="{Binding resources:TranslateExtension Text=Username}"
Compilers output: No property, bindable property, or event found for 'resources:TranslateExtension Text', or mismatching type between value and property.
The RESX stuff itself is working properly because when using the resource in code, the right text is shown.
Label Text="{Binding PasswordLabel}"
I also experiencing a warning in the output during compilation which I can't resolve:
0xdef00522 - Resources found for language(s) 'de,en' but no resources found for default language(s): ''. Change the default language or qualify resources with the default language.
Please have a look to the sourcecode located here: github.com/markus-fischbacher/quantumverde.git
Any help is appreciated.
Regards,
Markus
MacOS: Out of nowhere "MSBuild" error.
So yesterday everything was working just fine. But today when I was to open my project it no longer is working. When I try to clean/build I just get the same error Error: Unknown MSBuild failure. Please try building the project again
.
I tried to open Xamarin Studio and there the project builds/cleans just fine but in Visual Studio it's not working at all.
I tried googling it and it seems this is a problem, but I found no solutions to it.
Any help is appreciated!
Images not always showing
I'm making a game and I've noticed that images do not always display its imagesource. This seems to happen more frequently. I have all images set as Embedded with copy if newer in my project. My project now contains **578 **embedded images. I'm always using the normal Image component.
I get the images with this code:
public static ImageSource GetImage(Images name, ImageType imgType)
{
string key = "PartyTime.Resources." + imgType.ToString() + "." + name + ".png";
try
{
if (m_Images.ContainsKey(key)) return m_Images[key];
ImageSource img = ImageSource.FromResource(key);
m_Images.Add(key, img);
return img;
}
catch (Exception ex)
{
Classes.Globals.Log("GetImage(2) Ex: " + ex.ToString());
return ImageSource.FromResource(key);
}
}
I cant post images yet with this new account so I'll try to explain it with symbols below. Consider each [tile] as an image. Sometimes an image does not show the image assingned to the imagesource:
[tile][tile][tile][ ][tile]
Any suggestions would be greatly appreciated.