Anyone know a good way to adjust the line height in a label? I know I could make a custom renderer, but I figure someone has done this already or it's built in and I just can't find it.
Adjust Line Height in Label
Issue with uploading xamarin forms ios app to app store?
Hi,
I am planning to upload my xamarin forms ios app to app store. I refer the following youtube video for that.
Steps telling in the video:
1 Login to your developer.apple.com and select Certificate Identifiers and Profiles.
2. Click Appids under Identifiers and click + button.
3. Give App Id Description and Explicit App Id(Bundle Identifier of the App)
I don't know what is the Bundle Identifier of the app. From where I can find the Bundle Identifier details in my xamarin forms app?
In the video, he is telling about the Bundle Identifier from 2:00 min.
Thanks in advance
How to save image from File path and convert it to Byte array in Xamarin Forms
I'm having trouble reading images from my mobile app (Xamarin Forms)
I get the image path (string) but can't save it as a Byte Array
Any help would be appreciated!
Will my app be approved if I draw custom navigation and tab bars?
Due to the specific requirements of an app I have in mind, I need to draw custom navigation and tab bars using XF's built-in controls like Grid, StackLayout, etc.. This would be drawn on a ContentPage
and simulate a TabbedPage
with custom bindable properties like CurrentTab
etc. Unfortunately, it's not possible for me to use custom renderers and modify the existing TabbedPage
to my requirements, and so I'm looking at creating a single page app using just a ContentPage
and swapping views in and out as the user navigates to other "pages".
My concern is, does App Store and Google Play have strict guidelines when it comes to using a tabbed page such that only the default controls must be leveraged (UITabBarController
and ViewPager
)? I don't want to work months on an app only to realize it's not meeting their UI requirements.
Migrating to .Net Standard 2.0 is causing errors
Hi,
I have Migrated my existing PCL project to netstandard and now I am getting this error:
**/Users/jassim/Projects/ZayedAlKhair/packages/Xamarin.Forms.2.4.0.280/build/netstandard1.0/Xamarin.Forms.targets(3,3): Error MSB4062: The "Xamarin.Forms.Build.Tasks.FixedCreateCSharpManifestResourceName" task could not be loaded from the assembly /Users/jassim/Projects/ZayedAlKhair/packages/Xamarin.Forms.2.4.0.280/build/netstandard1.0/Xamarin.Forms.Build.Tasks.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. (MSB4062) (ZayedNotificationServiceExtension)
**
Kindly help..
Thanks,
Jassim
ListView.ItemDisappearing event is not triggered when the item removed from ItemSource
I am new with Xamarin.Forms, I have a listview with an item source.
The ItemSource
of the ListView is an ObserverableCollection
Unfortuntaley, when I remove an item from the ItemSource
, the ItemDisapperaing
event is not trigged. Yes, the list item is removed from the UI in the Android device.
However I implemented the ItemAppearing
and that works fine! It triggered.
Adding item working scenario:
- The
ShopCart.Instance.AddItem(randomItem)
called. ShopItemListView.ItemsSource
is refreshed with the newly added item.TotalAmount
's Text is updated with the right amount.
So the ShopItem_NewItemAdded function is called!
Clearing items from Shopcart scenario (not working)
ShopCart.Instance.Clear()
called.ShopItemListView.ItemShource
will be empty! The items not on the UI!- But the
TotalAmount
's text does not changed to 0.0! It still has the previous value.
It seems on the UI element the TotalAmount is not refreshed! In Debug I see after the Clear the ShopItemListView.ItemsSource
list is empty.
So the ShopItem_ItemRemoved
function is not called!
Here the Xaml.cs
public ShopView()
{
InitializeComponent();
BindingContext = new ShopViewModel();
ShopItemListView.ItemsSource = Shop.Instance.ShopItems;
// This is triggered, it works
ShopItemListView.ItemAppearing += ShopItem_NewItemAdded;
// This event is not triggered, it does not work
ShopItemListView.ItemDisappearing += ShopItem_ItemRemoved;
}
// This event is not triggered, it does not work
private void ShopItem_ItemRemoved(object sender, ItemVisibilityEventArgs e)
{
// If I put a breakpoint here the debugger never comes into this method
TotalAmount.Text = Shop.Instance.ShopItems.Sum(si => si.Price).ToString();
if (Shop.Instance.ShopItems.Count == 0) {
ShopInformation.IsVisible = false;
}
}
// This is triggered, it works.
private void ShopItem_NewItemAdded(object sender, ItemVisibilityEventArgs e)
{
TotalAmount.Text = Shop.Instance.ShopItems.Sum(si => si.Price).ToString();
ShopInformation.IsVisible = true;
}
Here is the shopcart singleton instance
public sealed class ShopCart : INotifyPropertyChanged
{
private static readonly ShopCart _instance = new ShopCart();
private ShopCart()
{
ShopItems = new ObservableCollection<ShopCartItem>();
}
public static ShopCart Instance
{
get
{
return _instance;
}
}
public ObservableCollection<ShopCartItem> ShopItems { get; set; }
public void AddItem(ShopCartItem ShopCartItem)
{
ShopItems.Add(ShopCartItem);
OnPropertyChanged("ShopItems");
}
public void Clear()
{
ShopItems.Clear();
OnPropertyChanged("ShopItems");
}
#region INotifyPropertyChanged Implementation
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
The ShopCart implement the INotifyPropertyChanged interface. But it seems the UI element is not notified.
How can I refresh the TotalAmount
Label on the UI after I removed every shop items from the shop cart?
How to position the TITLE in content tag in xaml page in the center?
Query 1.
== How to position the title in content tag xaml page in the center and bold font to not bold?
Simply How I can set style to the TITLE of xaml page of xamarin froms.
How to change status bar colour to black in xamarin forms?
How to change status bar colour to black in xamarin forms?
how to use camera in xamarin forms
Iam making cross platform mobile app with xamarin form but i do not know how to open camera in xamarin form i have already made button for it but on click i want to open camera plzz tell
When is Xamarin.Forms 3.0-Stable expected?
Hello team,
Do we have any ETA for Xamarin.Forms 3.0-Stable release?
Many thanks
How to change list view DataTemplate when orientation changes
Hi, I have Created a data template but its number of columns varies according to the device orientation. This is how I have created my data template
var dataTemplate = new DataTemplate(() =>
{
var cell = new ViewCell();
Grid cellGrid = new Grid();
cellGrid.RowSpacing = 5;
cellGrid.ColumnSpacing = 5;
cellGrid.Margin = new Thickness(5, 5);
cellGrid.RowDefinitions = new RowDefinitionCollection();
cellGrid.ColumnDefinitions = new ColumnDefinitionCollection();
//cellGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
int left = 0;
int top = 0;
int usedColumn = 0;
int fieldCounter = 0;
int maxColumn;
int columnSpan;
if(!isPortraite)
{
maxColumn = 20;
}
else
{
maxColumn = 10;
}
foreach (var field in viewModel.ScreenMetadata)
{
Label label = new Label();
Debug.WriteLine("MAX COLUMN = " + maxColumn);
if (fieldCounter >= viewModel.ScreenMetadata.Count())
{
fieldCounter = viewModel.ScreenMetadata.Count() - 1;
}
string relativeWidth = viewModel.ScreenMetadata.ElementAt(fieldCounter).FieldProperties["RELATIVE_WIDTH"];
string colorStyle = viewModel.ScreenMetadata.ElementAt(fieldCounter).FieldProperties["DISPLAY_STYLE"];
string key = viewModel.ScreenMetadata.ElementAt(fieldCounter).FieldProperties["COLUMN_NAME"];
Color fontcolor;
if (colorStyle == "BLACK_AND_WHITE")
{
fontcolor = Color.Black;
}
else
{
fontcolor = Color.Gold;
}
double relativeWidthDouble = Convert.ToDouble(relativeWidth);
if (!isPortraite)
{
relativeWidthDouble = relativeWidthDouble / 2;
}
columnSpan = (int)Math.Round(relativeWidthDouble * maxColumn, MidpointRounding.AwayFromZero);
usedColumn = usedColumn + columnSpan;
label.SetBinding(Label.TextProperty, "[" + key + "]");
label.TextColor = fontcolor;
cellGrid.Children.Add(label, left, top);
Grid.SetColumnSpan(label, columnSpan);
if (usedColumn >= maxColumn)
{
left = 0;
top = top + 1;
usedColumn = 0;
cellGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
}
else
{
left = left + columnSpan;
}
fieldCounter++;
}
cell.View = cellGrid;
columnSpan = 0;
fieldCounter = 0;
return cell;
});
return dataTemplate;
I have a method to detect device orientation and it successfully giving me the device orientation. I want to know how can I assign the DataTemplate when changes the orientation? Please help me. Thanks!
How can i set cursor colour to black not the default pink one?
How can i set cursor colour to black not the default pink one?
The call is ambiguous between the following methods or properties...
Hello,
I have started a new Xamarin.Forms project and after upgraded Xamarin.Forms package (3.0.0.446417), I got this warning on InitializeComponent method call in App.xaml.cs (The call is ambiguous between the following methods or properties: 'App.InitializeComponent()' and 'App.InitializeComponent()') or in pages ((The call is ambiguous between the following methods or properties: 'MyPage.InitializeComponent()' and 'MyPage.InitializeComponent()')).
This warning doesn't appear for next pages I have newly created.
Any idea?
Thanks.
What is the efficient way between Carousel and Tab when we have more than 5 number of Tabs?
Hi, I want to create a TabbedPage and I have more than 5 tab children. All the tab children are creating dynamically. I know in tabbed page when we increase the number of tab children the performance will degrade. And Instead of tabs we can use carousel as well. In performance wise what is the more efficient way?
ContentPage.ToolbarItems disappear after change page by slash
ContentPage.ToolbarItems disappear after change page by slash
Hi
This is MainPage with ToolBar:
<ContentPage.ToolbarItems>
</ContentPage.ToolbarItems>
MainViewModel:
Logout = new BitDelegateCommand(async () =>
{
await securityService.Logout();
await navigationService.NavigateAsync("/Login");
});
LoginViewModel:
await securityService.LoginWithCredentials(UserName, Password, "Owner", "secret");
await navigationService.NavigateAsync("/Main");
When I click LogOut and Login again ToolbarItems disappear in MainPage.
When I remove / (slash) before "/Login" or "/Main" , problem resolves.
But I don't want user can back to before page after login or after logout.
What should I do?
Access the masterdetailpage after login
Hi Forum How come my app crashes after tapping the Log in
Here is my code for log in
`public partial class LoginPage : ContentPage
{
public LoginPage ()
{
InitializeComponent ();
BackgroundColor = Color.FromRgb(51,10,120);
NavigationPage.SetHasNavigationBar(this, false);
}
async void OnLoginButtonClicked(object sender, EventArgs e)
{
var user = new User
{
Username = usernameEntry.Text,
Password = passwordEntry.Text
};
var isValid = AreCredentialsCorrect(user);
if (isValid)
{
App.IsUserLoggedIn = true;
App.Current.MainPage = new MainPage();
//Navigation.InsertPageBefore(new MainPage(), this);
//await Navigation.PopAsync();
}
else
{
messageLabel.Text = "Login failed";
passwordEntry.Text = string.Empty;
}
}
bool AreCredentialsCorrect(User user)
{
return user.Username == Constants.Username && user.Password == Constants.Password;
}
}`
How to Update label text from another class?
I know its a silly question but I am new in Xamarin.forms
I want to Update label text from another class in xamarin.forms. please guide me with a example. Thanks
Multiple PDF file is not opening in IPhone, how can i do this..
How can i open the multiple pdf or folder of these files..
Does Android support SharePoint.Client/SharePoint.Client.Runtime?
Hello - I'm building a Xamarin Forms application that pulls information from an on prem SharePoint site. The iOS version works as intended, however the Android version crashes immediately after launching. The cause of the crash appears to be Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll (both presumably calling System.Web.dll) which returns the following, despite being referenced directly:
05-31 23:03:42.275 D/Mono ( 1586): Assembly Loader probing location: 'System.Web'.
05-31 23:03:42.275 F/monodroid-assembly( 1586): Could not load assembly 'System.Web' during startup registration.
I have tried different versions of each reference, as well as different versions of Mono Android assuming it was a compatibility issue. I've tried the common suggestions to disable shared runtime and fast deployment, and I've tested on both emulators and real devices - nothing has resulted in the Android version of my application launching.
Any help would be much appreciated, thank you in advance.
Xamarin.Forms.Build.Tasks.XamlCTask task has been marked with the attribute LoadInSeparateAppDomain
ALL other solution packages are up-to-date, I am using the latest stable release of Xamarin Studio for Mac (7.1 (build 1297)) running Mac OS X 10.12.6. Further below please find some ADDITIONAL STEPS TAKEN and some ADDITIONAL INFORMATION.
Just upgraded my solution from sr2 to the latest Xamarin Forms package sr5. Now getting the following build errors while building PCL library:
/Src/MYFOLDER/packages/Xamarin.Forms.2.3.4.267/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(3,3): Error MSB4077: The "Xamarin.Forms.Build.Tasks.XamlCTask" task has been marked with the attribute LoadInSeparateAppDomain, but does not derive from MarshalByRefObject. Check that the task derives from MarshalByRefObject or AppDomainIsolatedTask. (MSB4077) (Utilities.Api)
/Src/MYFOLDER/packages/Xamarin.Forms.2.3.4.267/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(3,3): Error MSB4060: The "XamlCTask" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. (MSB4060) (Utilities.Api)
ADDITIONAL STEPS TAKEN
Cleaned entire solution
ADDITIONAAL INFORMATION:
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.1 (build 1297)
Installation UUID: 034ea3f9-f985-4e7e-89e7-b970f1896033
Runtime:
Mono 5.2.0.215 (d15-3/da80840) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 502000215
=== NuGet ===
Version: 4.3.0.2418
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
1.1.1
1.0.4
SDK: /usr/local/share/dotnet/sdk/1.0.3/Sdks
SDK Version: 1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 8.3.3 (12175.1)
Build 8E3004b
=== Xamarin.iOS ===
Version: 10.12.0.18 (Visual Studio Enterprise)
Hash: 4a279c9a
Branch: d15-3
Build date: 2017-08-02 12:38:11-0400
=== Xamarin.Mac ===
Version: 3.6.0.17 (Visual Studio Enterprise)
=== Xamarin.Android ===
Version: 7.4.0.19 (Visual Studio Enterprise)
Android SDK: /Users/kenwenyon/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 26.0.0
Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Xamarin Inspector ===
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT
=== Build Information ===
Release ID: 701001297
Git revision: 9c5299666538b2f8baf501418a5c064d784d64da
Build date: 2017-08-07 11:29:35-04
Xamarin addins: 3bb0c32a14f1b7e368bf5ac53a84c3581c019391
Build lane: monodevelop-lion-d15-3
=== Operating System ===
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Thu Jun 15 17:36:27 PDT 2017
root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64