Hi, I was wondering how to center things in a StackLayout. I can set the orientation to StackOrientation.Vertical and set the VerticalOptions to LayoutOptions.Center, but the items are only centered horizontally at the top of the screen. How do I have a stack that expands starting in the middle of the device's screen, so that I don't have to hard-code numbers for the padding?
How to center things Vertically in a StackLayout when the orientation is Vertical
Style FormsCommandBar
I have a Xamarin Forms app and in UWP I'd like to alter the colours of the ellipses button and secondary menu. I've been following the advice provided in another forum post (apparently, I'm not allowed to post links):
@MatthewR said:
If you want to change just the command bar's overflow background color you can change the FormsCommandBar style.Add this style (copied from Xamarin's Source Code) to your app.xaml in your UWP project.
You can then edit the CommandBarOverFlowPresenter's background Color like this:<Application xmlns:uwp="using:Xamarin.Forms.Platform.UWP" . . .> <Style TargetType="uwp:FormsCommandBar"> . . . <CommandBarOverflowPresenter x:Name="SecondaryItemsControl" Background="<YourBackgroundColorHere>" IsEnabled="False" IsTabStop="False" Style="{TemplateBinding CommandBarOverflowPresenterStyle}"> <CommandBarOverflowPresenter.ItemContainerStyle> <Style TargetType="FrameworkElement"> <Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="Width" Value="NaN" /> </Style> </CommandBarOverflowPresenter.ItemContainerStyle> <CommandBarOverflowPresenter.RenderTransform> <TranslateTransform x:Name="OverflowContentTransform" /> </CommandBarOverflowPresenter.RenderTransform> </CommandBarOverflowPresenter> . . . </Style> </Application>
I needed to do this to avoid changing action sheets and pickers background colors.
*Note: Make sure not to specify a x:key for the FormsCommandBar style or it won't work.
However, the style is not being applied. I put my style in the App.xaml resource dictionary. I'm using Xamarin Forms 2.5.0.280555.
Am I missing something?
Animation in Listview cell deletion
I've created a custom listview with multiple cells, and added a cross icon to each viewcell in the list. While clicking on the cross icon particular cell will be removed from the list. Can anyone please let me know if there is any method of implementing any animation or any transition to a single view cell on deletion?
Customized Tree view in Xamarin Forms
I'm following this plugin -github.com/danvanderboom/Xamarin-Forms-TreeView- for creating tree view but I'm not able to add plus and minus icon in tree view. The plus and minus icon should change as per the logic of ShowExpandCollapse property. Please help me with this ASAP. Your help will be appreciated.
symbologyname for scanned barcode?
i am using honeywell sl42 sled,i have included captuvo.dll to my app,able to fire follwing events getting rawdata for the scanned barcode
[Export("captuvoConnected")]
public void CaptuvoConnected()
{
}
[Export("captuvoDisconnected")]
public void CaptuvoDisconnected()
{
}
[Export("decoderRawDataReceived:")]
public void DecoderRawDataReceived(Foundation.NSData data)
{
}
But unable to get symbology name using below code,but this event is not getting fired
[Export("SymbologyName:")]
public string SymbologyName(Symbology symbologyname)
{
}
Thanks,
vijay
Reusable UI Widget
There are Pages, which can hold a variety of cross-platform views. Yet, there seems to be no way to isolate these and re-use them, ala .net controls. Isn't that the basic premise of reusable UI? I have scoured the internet, yet can find nothing after a couple years of tracing this. Am I missing something? Could someone point me in the right direction?
How to set the application to run in landscape mode only?
I have created a xamarin forms application which i want to run on windows 10 tablet only in landscape mode whether or not the deviceOrientation is on. I checked the checkBox of landscape and landscape-flipped in package.appxManifest but it still rotate in portrait mode. can anyone help me on this? How can I set my app to run in landscape?
The Application is In Break Mode
Hello i m getting an output, but its comes as White Screen.Below i added screen shots.
After the Application build and execute in my mobile white screen appears and in my IDE it showing "The Application is in Break Mode".
When i pressed Continue execution it showing "No Compitable Code Running".
Anybody Help me to resolve this error Thanks in Advance. -)
"The application is in break mode" when use Map?
Hi everybody!
I'm working with Map in Xamarin.Forms
I have a button to navigate to MapPage. Android app crash and show "The application is in break mode" but UWP work fine?
Windows Phone UWP - Content is 'hidden' behind the Back/Home/Search button menu
I have a simple page with a grid view. The grid has two rows, the first has a height of *85
, the second *15
. However, the content in the second row is partially blocked by the Back/Home/Search buttons on the phone. Is this a bug? If not, what is a good way to work around this?
In case it matters, the content in the first row of the grid is a webview, and the content in the second row of the grid Is a horizontal stacklayout containing labels.
How can I change ViewCell height?
I have ViewCell in TableView, I need to put two buttons there:
<ViewCell Height="100">
<StackLayout Margin="10,0">
<Button Text="Button 1" />
<Button Text="Button 2" />
</StackLayout>
</ViewCell>
Height don't work. How can I change ViewCell's height?
OnAppearing of root page isn't fire after PopToRootAsync. Is it normal?
Hello. I have strange behavior. OnAppearing of root page isn't firing after PopToRootAsync and PopAsync. Is it normal or bug?
I think I solved this problem using messaging center, but I think it is not good solution.
Tree View in Xamarin forms.
Hello guys,
Is there any way to implement Tree View in Xamarin forms ? If yes then please let me know how ?
Thank you.
How to select values for entry (text box) from different forms?
Hello Friends,
I have a form with three Picker controls for user to select values. All these Pickers are bound with data source. Clicking on them pops up all the items and user can select the items. This is working correctly.
However what the issue here is there are lots of items in the data source so I need Search functionality for users to look for a item and select it. Can you please help me how can I achieve this?
I have tried opening a new form and selecting values from there but I don't know how to preserve the values of other picker controls when coming back from new forms.
Please help me how can I achieve this.
Thank You
Consuming REST services
What is the best method for consuming REST services which are locally deployed? I am specifically having issues with utilizing HTTPS for iOS. When calling the web service from iOS (the iPhoneSimlator), I receive a "TrustFailure" web exception. I think this is because the certificate used is self-signed (it's not secure because I am using my internal IP address and the certificate is issued for localhost) when using IIS Express. Does this mean I need to "publish" my API to IIS (or Azure) and use a valid certificate in order to consume the service? This seems like a lot of work for development, especially since I am creating the REST service and mobile application at the same time.
My development environment is:
I have reviewed this and this, but neither really touch on this issue. Any advice on a streamlined workflow would be much appreciated.
How can I consume WCF service without Protable Class!
Hi,
As I know, right now we can't create project with Protable Class, so I don't know how to work with WCF. Anyone have a suggestion?
Getting Exception : Xamarin.Forms.Xaml.XamlParseException: Cannot assign property "Text"
Hi All,
I am Working on Multilingual functionality while i am binding my label with the Key , It is trowing Exception.
Please help Me.
`
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="120" />
<RowDefinition Height="200" />
<RowDefinition Height="77" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="280" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="1" Orientation="Vertical" Grid.Column="1">
<Label Text="{translator:Translate OneApp}" TextColor="#FEFEFE" Font="15" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center"></Label>
</StackLayout>
</Grid>
</ContentPage.Content>
`
XAML control 'does not exist in the current context'
I'm getting an intermittent error where my XAML codebehind complains that a control 'does not exist in the current context'.
This is my .xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp_Mobile.IncidentReport"
Title="Report Incidents">
<StackLayout Spacing="5" x:Name="layoutIncident">
<Label Text="Incident Type:" VerticalOptions="Center" HorizontalOptions="StartAndExpand" />
<Picker x:Name="IncidentTypePicker1" Title="Incident Type" HorizontalOptions="FillAndExpand">
<Picker.Items>
<x:String>Theft</x:String>
<x:String>Fire</x:String>
<x:String>Accident</x:String>
</Picker.Items>
</Picker>
<Label Text="Incident Description:" VerticalOptions="Center" HorizontalOptions="StartAndExpand" />
<Editor x:Name="IncidentDescription" WidthRequest="400" HeightRequest="200" />
<Button Text="Submit" Clicked="OnButtonClicked" />
<Label x:Name="lblMessage" Text="" VerticalOptions="Center" HorizontalOptions="StartAndExpand" />
</StackLayout>
</ContentPage>
And this is my .xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace MyApp_Mobile
{
public partial class IncidentReport : ContentPage
{
int count = 0;
public IncidentReport()
{
InitializeComponent();
}
public void OnButtonClicked(object sender, EventArgs args)
{
lblMessage.Text = IncidentTypePicker1.SelectedIndex.ToString() + " " + IncidentDescription.Text;
count++;
((Button)sender).Text =
String.Format("{0} click{1}!", count, count == 1 ? "" : "s");
}
}
}
The IDE (Visual Studio 2013) sometimes complains that IncidentTypePicker1 and IncidentDescription do not exist, and sometimes it does not complain and I am able to Build and Deploy the app. Is there any reason for this intermittent error?
Actuall working sample of Xamarin Form that does REST on Android
Can someone please provide an actual working sample of a Xamarin Forms project that also works with Android? We tried to use the TODORest Sample which initially wouldn't even build but after having downloaded the latest version from GitHub we at least got it to work. But communicate with the REST API just does not seem to work on Android (but does on UWP). There are numerous threads here and on other forums about similar problems with HttpClient, RestSharp etc.
Looking for a free DataMatrix writer
What the title says. The problem with ZXing is it writes only a low resolution DataMatrix which can't be upscaled.