Hi I am using 2 Entry filed in List view One In Item Price and other is Quantity. I want to update sub total when value changed in Item Price or Quantity.
I have add a image for reference.
How to update value in listview
How to open excel sheet in your app
i am using xamarin forms how can i open excel sheet in my app its urgent
Issue while opening Xamarin form from BroadcastReciever class
This is for tracking incoming and outgoing phone calls. I am pushing a Xamarin form in the application Navigation stack from BroadcastReciever class using following code:
var phoneAddPage = new SomePage();
Xamarin.Forms.Application.Current.MainPage = new NavigationPage(phoneAddPage);
The page is getting pushed properly as expected. Issue is the page is overlapped by Splash Screen when application is opened. The form is functioning properly, overlap is the only issue.
Use .Xaml X:names in another .Xaml.cs?
Hi, can anybody tell me if this is possible and the best way to do it.
I have created a ContentView which is called Page21.xaml inside that file I have an Entry with an x:Name of 'page21entry'. Is there anyway to pull that through to my MainPage.xaml.cs so I can use it in a function.
Hope that makes sense
Fix black screen after splashscreen in Android using Xamarin Forms
I have a little problem, the splashscreen is loaded fine but, after that appear a black screen until the app is loaded.
I was seaching for days but and I can't find a solution,
Is someone have a solution for this?
I follow this instructions to get a splashsreen centered:
MainActivity.cs
[Activity(Label = "AppName",
Icon = "@mipmap/icon",
Theme = "@style/MainTheme",
MainLauncher = false,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] { Intent.ActionView },
Categories = new[] {
Intent.ActionView,
Intent.CategoryDefault,
Intent.CategoryBrowsable
},
DataScheme = "https://waze.com/ul")
]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
static readonly string TAG = "X:" + typeof(MainActivity).Name;
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
Rg.Plugins.Popup.Popup.Init(this, bundle);
Xamarin.FormsMaps.Init(this, bundle);
AndroidAppLinks.Init(this); //enlace profundo
LoadApplication(new App());
if (Intent != null && Intent.DataString != null)
{
try
{
string email = "";
email = Intent.Data.GetQueryParameter("email");
if (email != null && email != "")
{
Xamarin.Forms.MessagingCenter.Send<string, string>("", "AppLaunchedFromDeepLink", email);
}
}
catch (Exception e)
{
//Catch error
Log.Debug(TAG, "Ha ocurrido una excepcion en MainActivity: " +e);
return;
}
}
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
SplashActivity.cs
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : AppCompatActivity
{
static readonly string TAG = "X:" + typeof(SplashActivity).Name;
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
base.OnCreate(savedInstanceState, persistentState);
Log.Debug(TAG, "SplashActivity.OnCreate");
//StartActivity(typeof(MainActivity));
}
// Launches the startup task
protected override void OnResume()
{
base.OnResume();
Task startupWork = new Task(() => { SimulateStartup(); });
startupWork.Start();
}
// Simulates background work that happens behind the splash screen
async void SimulateStartup()
{
Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
await Task.Delay(1000); // Simulate a bit of startup work.
Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
//Finish();
}
}
styles.axml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<style name="MyTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#901D3E</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#7c1231</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#901D3E</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#901D3E</item>
</style>
</resources>
splash_screen.axml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<style name="MyTheme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#901D3E</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#7c1231</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#901D3E</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#901D3E</item>
</style>
</resources>
I know that if I follow this video, I can get a successful splashscreen (using only a image like a splashscreen) without black screen, but when the orientation is change, the image is it distorts.
Thanks in advances.
Error MT2002
Xamarin Forms project, visual studio 2017 15.9.4. I compile a project with connection to macbook.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3): error MT2002: Can not resolve reference: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Resources.Reader.dll
Showing DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT when loading a page
Redirecting to App.g.i.cs
when loading a page in xamarin UWP. Code control comes to the following if block.
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
If I mouse over the e showing {Windows.UI.Xaml.UnhandledExceptionEventArgs}
I am not understanding what is the problem? Is this related to some error in XAML? This issue is only on the windows app, Android and IOS apps parts are working fine.
Thanks in advance
Hamburger menu Xamarin.Forms (especially for Android + iOS).
Good day!
I'm sorry for disturbing you.
Im new in Xamarin Forms and i
m trying to build a app which has hamburger menu like this...
Sorry but can not add screenshots ((
I found this in the Internet, but this is not the case and I could not add it
How can I add this correctly, please can u something advise or help with this?
Thank you in advance!
Can I Unsubscribe a MessagingCenter multiple times?
In my application I am Subscribing the MessagingCenter from Page 1 and the data received from Page2,so how to unsubcsribe the messaging center(which already subscribed from page 1) when user press hardware backbutton without sending any values?
Deployment failed. Architecture not supported.
Hi
I am getting the below error while deploying..
The package does not support the device architecture (x86). You can change the supported architectures in the Android Build section of the Project Options.
Deployment failed. Architecture not supported.
How to work 2 projects in 1 solution?
I can navigate 2nd project?? and how do ?
jarsigner error java.lang.runtimeexception keystore load keystore was tampered with, or password wa
Getting the title error when publishing android APK in Xamarin Forms. I am trying to do this from Mac visual studio.
Screenshot:
I am sure my password is correct. Is there any other reason for this issue? What is keystore tampering?
Please help me.
How to solve the below issue which i am getting while writing UI tests
This is a simple UI test which I have created for a Xamarin.Forms application and I am getting this error while running tests.
Let me know how to solve this issue.
Get the selected entry to only update this when serial scanning
Hello,
I have been working with scanner devices, only using keyboard interfaces and i had no problems, because you only have to select the entry where you want to "paste" the value of the scanned barcode, and scan. Nothing more, the scanned value actually updates the entry value where you are pointing to.
But now that i have to use the serial interface to use COM ports, and i have a problem.
What i have succesfully done since now is:
1- open the serial port where my barcode scanner device is connected,
{
serialPort = new SerialPort();
Close();
serialPort.PortName = portName;
serialPort.BaudRate = baudRate;
serialPort.Parity = parity;
serialPort.DataBits = dataBits;
serialPort.StopBits = stopBits;
// Set the read/write timeouts
serialPort.ReadTimeout = 500;
serialPort.WriteTimeout = 500;
serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
try
{
serialPort.Open();
this.IsOpen = true;
}
catch (Exception e)
{
throw new Exception(e.Message);
}
return true;
}
2- Listen to the scan event and update the value of the "ScannedText" variable (located in BaseViewModel.cs) to show the barcode value on the xaml:
private void DataReceivedHandler(object sender, EventArgs e) //SerialDataReceivedEventArgs
{
SerialPort sp = (SerialPort)sender;
text = sp.ReadExisting();
//Send the value to the ViewModel
BaseViewModel.Current.ScannedText = text;
}
Xaml:
<Entry x:Name="BarcodeEntry" Text="{Binding ScannedText, Source={x:Static base:BaseViewModel.Current}}"
THIS WORKS, the value of the scanned barcode is printed on the xaml entries where the binding variable is the "ScannedText" variable.
But what if i have more than one entry on my page and i want to update ONLY the entry value where i'm actually pointing, and do nothing to the other one? I guess i don't should use variables for this and send the entry to the event, but don't know how. I'm really stucked.
Thanks!
Inconstant behavior with different phones with VideoView
Hey everyone.
I've recently picked up Xamarin Forms to make a stream player app, but I've come across a problem that I can't seem to solve.
My problems are related to making implementing a video view within my app (Android specifically, I'm not focusing on iPhone at the moment).
The result I'm wanting to achieve is having a videoview together with webview taking 40% and 60% of vertical screen space respectively. While if the phone is rotated horizontally, filling the whole screen with only videoview taking all screen.
Basically what I'm trying to do is define my view as a grid with two rows and place a videoview and webview inside like this:
`
<Grid.RowDefinitions>
<RowDefinition Height="40*" />
<RowDefinition Height="60*" />
</Grid.RowDefinitions>
<controls:VideoPlayer
VerticalOptions="StartAndExpand"
HorizontalOptions="StartAndExpand"
Grid.Row="0"
AutoPlay="True"
Source="{Binding StreamUrl, Mode=OneWay}" />
<WebView
Grid.Row="1"
Source="{Binding HtmlSource, Mode=OneWay}" />
</Grid>
`
The implementation of VideoView on Android follows the Microsofts' guide: docs.microsoft[dot]com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/video-player/, with the exception of the VideoView being put in RelativeLayout with there paramaters:
LayoutRules.AlignParentLeft, LayoutRules.AlignParentRight, LayoutRules.AlignParentBottom, LayoutRules.AlignParentTop,
as I want it to fill the whole screen space rather than being centered/match aspect ratio.
And the way I currently handle the rotation of screen to resize the elements:
`protected override void OnSizeAllocated( double width, double height )
{
base.OnSizeAllocated( width, height );
if( width > height ) {
// Rotated horizontally
gridLayout.RowDefinitions[ 0 ].Height = new GridLength( 100, GridUnitType.Star );
gridLayout.RowDefinitions[ 1 ].Height = new GridLength( 0, GridUnitType.Absolute );
}
else {
// Rotated vertically
gridLayout.RowDefinitions[ 0 ].Height = new GridLength( 40, GridUnitType.Star );
gridLayout.RowDefinitions[ 1 ].Height = new GridLength( 60, GridUnitType.Star );
}
}`
When deploying on the android emulator which is running Android 8.1.2 or two of my phones where one is running 8.0.0 and 7.1.2 it produces the expected behaviour, but when deploying on my LG G4, which is running 6.0 when rotating the phone from vertical to horizontal the videoview will not fill the whole screen, but rather the same space as on vertical and afterwards, if phone is rotated again to vertical, it will zoom into the left corner of the videoview.
Here are screenshots of what is happening:
1) View is positioned vertically:
us.v-cdn[dot]net/5019960/uploads/editor/d1/92pnge4sgzxi.png
2) Rotated horizontally:
us.v-cdn[dot]net/5019960/uploads/editor/0y/zcc9k9pqlgbz.png
3) Rotated vertically again:
us.v-cdn[dot]net/5019960/uploads/editor/5e/pustgdj7hauz.png
As you can see, initially if fills the whole space, but once rotated horizontally it will not fill anymore either vertically or horizontally and if the screen is rotated once again, the vertical view is now zoomed in to the left side.
I've been looking into this issue and it seems to be affecting other people as well (coincidencally with the exact same phone), as described in this Github issue: github[dot]com/martijn00/XamarinMediaManager/issues/233
Since the first instinct with something like this is to blame your code so I went ahead and tried some of the available implementations on Github. One of these was github[dot]com/adamfisher/Xamarin.Forms.VideoPlayer which produced the exact same broken behaviour.
Afterwards I gave a go with the ExoPlayer implementation (much appreciation for everyone that made bindings for it) here: github[dot]com/martijn00/ExoPlayerXamarin and while it actually resized the videoview when rotating the screen I can't seem to make it fill the whole parent, where it rather keeps it in centrer and ignores Verical/HorizontalOptions of "StartAndExpand". The first implementation of VideoView (Microsofts') seem to also work properly when I specify the RelativeLayout paramaters as CenterInParent, but unfortunately that is not the effect I want to achieve.
In the end I tried to switch to RelativeLayout to see if it solved my issue, and unfortunately it produces the same effect.
So I'd wondered whether anyone else has had similar issues and if someone could help me solve this issue of getting VideoView to fit the whole allocated space and resizing properly when rotating the screen on all android devices. Or maybe point out the issues in my way of trying to resize the videoview when screen is rotated?
Much appreciated.
Custom Renderer erroneously instantiated multiple times
I have a Master-Detail pattern Xamarin Forms app in which the landing detail page has a HybridWebView in it.
On iOS, I have created a custom renderer for that Xamarin Forms HybridWebView.
The problem is that every time I leave the page by clicking a Master item, and then come back into this page, that an additional instance of the custom renderer is created: I've proven this because I create an ID for each renderer in it's constructor, when it is created.
Because both are bound to a Uri in the viewmodel, they both make a call to the uri.
Of course the user sees only one, but I need to stop this behaviour!
Any ideas how this is occurring?
Kind regards,
Anthony
The renderer is a WKWebView, btw!
Custom layout for TabbedPage tabs
Hi.
Can I edit the tabs' layout of a TabbedPage to be like I want?
I mean, I want to customize the tabbar layout with my own, like in the image below:
How can I achieve this?
I need to create a custom User Control? I need to create a custom Layout?
Thank you so much.
I'm very grateful for this community and Xamarin team.
Best regards.
Listview Issue
Hello i am now having a problem with my listview
this is what were trying to achieve
but i get stuck because i have no idea how i can like cut viewcells and place them next to eachother.
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<StackLayout HorizontalOptions=" VerticalOptions=" HeightRequest=" WidthRequest="100">
<Image Source="{Binding ImageNaam}"
Aspect="AspectFit"/>
</StackLayout>
<Label Text="{Binding GerechtNaam}"
TextColor="Black"
FontAttributes="Bold"
HorizontalOptions="Center"
VerticalOptions="Start"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
How to compress SignaturePad Image?
Hello,
I am using Signature Pad in my application and I want to compress my image before getting it.So is there any compression method for signature pad?
Tailwind Traders TwoProductItemTemplate Binding
Hi! I've been going through the Tailwind Traders app, examining their code and learning a bunch, attempting to replicate a lot of their stuff to gain the experience. I'm currently stuck on how they're databinding their ProductView XAML to their ProductViewModel? I notice in the codebehind for the ProductCategoryPage in their WireProductsUpWithListView
method that they are merely setting their ListView
's source to basically a list (tuple) of ProductViewModel
s.
I similarly have a ListView
that is successfully binding to my custom ItemTemplate, and I even get each item to show in the ListView, the data isn't being bound however.
I have a feeling it lies in their ItemTemplate, the code I'm having a hard time understanding:
<local:ProductView BindingContext="{Binding Item1}" />
<local:ProductView
Grid.Column="1"
BindingContext="{Binding Item2}"
IsVisible="{Binding ., Converter={StaticResource IsNotNullConverter}}" />
I understand this is just for creating 2 columns of ProductView
, and an empty space for if there is an odd number, but I cannot for the life of me figure out how they are BindingContext = "{Binding Item1}"
. I can't figure out what exactly that Item1 or Item2 is, I have searched the entire solution for what it's binding to, with no luck. From my understanding, shouldn't their BindingContext's be to the ProductViewModel? I haven't managed to find anything substantial online for this kind of binding, unless I suck at Google haha, any help would be appreciated!