Hi ,
I have a saved access token in my mobile app , it contain also a web View how to use that access token to no login directly ?
Xamarin forms WebView headers
Improve webview performance
Do you have any suggestion how to improve Web View's performance?
Thanks in advance ``
How to create a custom template for ViewCell composed of 2 template
Hello,
I use a dozen of ListView (SfListView from SyncFusion) in my application.
Here is the kind of template I use :
My ListViewItem contains a button that set the ListViewItem with an IsSelected property.
When a cell is selected, I display a list of command to navigate to other pages.
I'm looking for a way to extend the ListView to expose 2 Bindable Property of type ControlTemplate because all my ListView as a "menu" button on the right and I wanted to factorize some logic used to force the layout update of the selected cell.
I want to have 2 ControlTemplate. 1 for the traditionnal ItemTemplate and 1 for the list of available menu actions.
I've been struggling all day long trying to make it work but it's harder to customize with XForms' XAML than traditionnal XAML.
Did anyone achieve something similar ? Should I extend ViewCell and expose some control template and other bindable properties inside or is it enough to expose them in the ListViewExtended and use those BP inside a control template with TemplateBinding ?
Any help/thought on this will be very appreciated.
The only workaround I found to work is to dupplicate all the code or having a BaseListPageViewModel but that's far from the best solution IMHO. (and I can't factorize the XAML, only the code exectuted by the ListView)
Have a good day and thanks for your time if you read my problem so far
Is there a way to force a scrollbar's visibility
Hello,
I have a ScrollView that contains a RepeaterView.
On both Android and iOS the scroll bar aren't initially visible. When I start scrolling they appear and later auto-hide. While I understand this is the expected behaviour is there a way to change this behaviour so the scroll bar are always visible and don't auto-hide?
Thanks.
Xamarin forms WebView headers
Hi ,
I have a saved access token in my mobile app , it contain also a web View how to use that access token to no login directly ?
How to center a text using the TitleView feature?
Im trying to center a text using the new feature of forms to design our own TitleView. But strangely, we only have access to the space after the button, so centering a text offset all the text to the right because of the space of the button and the content stay uncentered... Yes, I can add a negative margin but this is not an acceptable solution since pushed navigation page got different button size than my master page... Is there a real way to center the text label? On this example, Last Entries should be center of the screen
<NavigationPage.TitleView>
<StackLayout Orientation="Horizontal" VerticalOptions="CenterAndExpand">
<Label Text="Last Entries" HorizontalOptions="CenterAndExpand" TextColor="White" HorizontalTextAlignment="Center" FontFamily="{StaticResource LatoRegular}"></Label>
</StackLayout>
</NavigationPage.TitleView>
Need experts suggestion!
Dear Experts, I have a dynamic crm custom solution by which I can search entities like accounts, contacts etc. by address, region, territories, by drawing shape and show results on bing map. I also can add annotations, objects, pins, layers etc.
Now I want to develop both android and ios app for this custom solution with those existing features. I want my app should be fast and responsive.
Should I use Xamarin.Forms or native android or native swift is fine for such kind of functionalities.
Please suggest me your valuable advises.
Thanks in advanced.
Why Xamarin.Forms nullReferenceExceptions are appearing with timeout exceeded message?
Does anyone know why we see this exception message when there is null exception? This isn't a helpful message when we get such exception in Release logs. Is this a bug or enhancement to report?
Cannot add new page to xamarin.forms project in vs17.
I have xamarin.forms project downloaded from azure demo(todo list). I can add class or page to .droid and .ios projects, but not to .myapp. Even if i copy files to the .myapp manually then they automatically go to .droid. Any ideas how to fix that, or it is how it should be?
Scrolling of SKCanvasView
Hello,
I am new to Xamarin.Forms.
I am drawing certain vector graphics on SKCanvasView which i have put into ScrollView on Xamarin.Forms as I need to scroll created graphics both horizontally and vertically. However I am unable to this.
Please guide me.
Thanks in advance.
Ajit Suryavanshi
Update/Refresh ListView or ListView Item without starting from the top
Hey there.
Is there a way to update/refresh my ListView or ListView Item? Currently the only way to update/refresh my ListView is this:
public void NewsList_Selected(Object sender, SelectedItemChangedEventArgs e)
{
var a = e.SelectedItem as NewsEntry;
var b = from c in newsEntries
where (a == c)
select c;
foreach(NewsEntry d in b)
{
d.Text = d.TextFull;
}
// Below is my update/refresh thing
NewsList.ItemsSource = null;
NewsList.ItemsSource = newsEntries;
}
But that means that if I scroll down in my ListView and select an Item I will jump to the top of my ListView again. But I need to stay at the same spot I left. Is there a solution?
How to set a custom WKNavigationDelegate while maintaining original functionality
I have implemented a WkWebViewRenderer
subclass, trying to disable navigation in certain cases. Based on a discussion on the forums ("Setting delegate of control in custom renderer results in lost functionality" is the title, can't post the link) I take care to save the current NavigationDelegate in a class property.
if (_oldDelegate == null && this.NavigationDelegate != null)
{
_oldDelegate = (WKNavigationDelegate)this.NavigationDelegate;
}
Then I override all the methods available in the assembly where calling the same method on oldDelegate
is allowed, like this:
[Export("webView:didFinishNavigation:")]
public void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
{
_oldDelegate.DidFinishNavigation(webView, navigation);
}
Some of the methods don't let me do this, like the decidePolicyForNavigationResponse
one, throwing Foundation.You_Should_Not_Call_base_In_This_Method
exception. The Navigating/Navigated
events in the PCL seem to be triggered fine without them, but I wonder if it's something missing.
The final step is overriding decidePolicyForNavigationAction
method, where I try to set WKNavigationActionPolicy.Cancel
:
[Export("webView:decidePolicyForNavigationAction:decisionHandler:")]
public void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action<WKNavigationActionPolicy> decisionHandler)
{
if (navigationAction.Request.Url.ToString().Equals("customurl"))
{
decisionHandler(WKNavigationActionPolicy.Cancel);
}
else
{
decisionHandler?.Invoke(WKNavigationActionPolicy.Allow);
}
_oldDelegate.DecidePolicy(webView, navigationAction, decisionHandler);
}
But the app crashes here _oldDelegate.DecidePolicy(webView, navigationAction, decisionHandler);
with the message Completion handler passed to -[WKPrivateNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:] was called more than once
.
So, my question is, how can I do some custom login by overriding the WebView's delegate methods while keeping the default functionality in the PCL?
System.IO.FileNotFoundException: Could not load assembly “AppName.dll” after update xamarin forms
I can't build the project and I'm getting this exception after updating to latest Xamarin Forms 3.4.0.1008975 , if I downgrade it to 3.1.0.583944 or lower the exception will gone and I can build successfully.
I've tried to update VS and clean - close - reopen but the problem still there , I also tried to move the project to C:/ but no luck .
Error The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.FileNotFoundException: Could not load assembly 'SouqAlData, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'SouqAlData.dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection
1 jars, ICollection1 resolvedResourceDirectories, ICollection
1 resolvedAssetDirectories, ICollection1 resolvedEnvironments) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() SouqAlData.Android
Getting Picker selected item string to JSON
when using Condition = this.FindByName<Picker>("tyrePicker").SelectedItem.ToString()
then saving it to a .json it is bring back this result appName.Condition instead of either yes,no.
Does anybody know why this is happening ?
grouped(!) ListView doesn't update when deleting item
hello, I really need help updating my ListView.
Normally, when deleting an item out of my Observable Collection, the ListView updates correctly.
But when I delete an entry inside of a grouped ListView (that's bound to a Observable Collection), it doesn't.
Please inform me, if you need further information. I already googled my problem but didn't find a solution.
DatePicker year list only shows 8 entries in Android
Hi,
I just got this requirement to let user select dates that could be well in the past. I am using the DatePicker but found out that, in Android, it only shows 8 years to choose from. For example, if I set the date to today and then tap the year at the top the list of years starts at 2016 and ends in 2022. I can tap the earlier one and then re-tap the year, etc but it is not practical if I need to select 1910, for example.
How can I add years to this list?
Thanks
P.S. On iOS the list is not filtered at all.
Custom Header in Webview
Hi guys,
I'm building an app with authentification, then I need to send the Token I get in every page url call. I'm using xamarin.forms and all the logic of my code is shared
I manage to get the page content using an http client (but the css and html are not "recognized" therefore the result is very bad)
I started to implement WebViewRenderer for Android and iOS to add header when I load url but I struggle to display it well in the webview.
Class in PCL
namespace SageMCOApp
{
public class BaseUrlWebView : WebView {
public static readonly BindableProperty UriProperty = BindableProperty.Create(propertyName: "Uri",
returnType: typeof(string),
declaringType: typeof(BaseUrlWebView),
defaultValue: default(string));
public string Uri
{
get { return (string)GetValue(UriProperty); }
set { SetValue(UriProperty, value);}
}
}
}
**Class in android **
namespace SageMCOApp.Droid
{
//public class AuthWebViewRenderer : ViewRenderer<BaseUrlWebView, Android.Webkit.WebView>
//{
public class AuthWebViewRenderer : WebViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
{
base.OnElementChanged(e);
Log.Info("Test", "A l'intérieur du renderer");
BaseUrlWebView formsWebView = e.NewElement as BaseUrlWebView;
Control.Settings.JavaScriptEnabled = true;
this.Control.SetWebViewClient(new AuthWebViewClient());
}
}
}
WebViewClient
namespace SageMCOApp.Droid
{
public class AuthWebViewClient : WebViewClient
{
public override bool ShouldOverrideUrlLoading(WebView view, string url)
{
var Token = "here is the token";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Add("Authorization", "Bearer " + Token);
view.LoadUrl(url, headers);
return true;
}
}
}
I know thanks to the debug that the shouldoverrideurlloading is performed but the server doesn't received the header.. I pretty sure I missed something or something is wrong but the code I see in the forum doesn't work.
Thanks a lot for your help !
Insert byte array (BLOB) to SQLite table
I am trying to insert the image data which is in the form of byte array to SQLite table,
public List InsertImageOffline()
{
string strcmd = "insert into OfflineInsertImage(JOB_NUMBER,MAGE_BYTE,SyncData) values (" + JOB_NUMBER + ",'" + IMAGE_BYTE + "','" + SYNCDATA + "')";
return dbConn.Query(strcmd);
}
after debugging i found the query as below
insert into OfflineInsertImage(JOB_NUMBER,IMAGE_BYTE,SyncData) values (1809,,'System.Byte[]','1')
Question;
How do we insert the BLOB datatype into sqlite table. I am using Xamarin Forms(PCL)?
Qestion about BT Printing with dependency service
Hi to all, i need to build a solution (for Ios and Android) where i can print an "invoice" with text, image, qrCode, barcode etc, thats can i print with a mobile blootooth printer. I know that i can use zebra, but i don't want tying the print process with a fixed printer device, and i don't want binding solution with zpl template. I found some articles thats describe the scenario where i can use dependency service for printing. What i want is that user, when click on "print" button can print the invoice without pass by Ios or Android popup (in the articles that i describe above user must choose printer in Device (ios or android), and after click on new print button). Is possible set blootooth connection with printer and send the "document" (or the text that i want print), in only one click in my app?
How to make ScrollView IsTabStop true only if the scroll bar is present?
On UWP, I have a ScrollView that has IsTabStop=true and that has TabIndex set to an appropriate value. Using ScrollView, the scroll bar is only visible (or space is only allocated for the scroll bar) if the children of the ScrollView do not fit in the space available. The user can only do something with the ScrollView (such as using the cursor keys to scroll) if the children of the ScrollView do not fit in the space available. It would appear then that nothing useful is achieved by being able to tab onto the ScrollView unless the children of the ScrollView do not fit in the space available. Is there any way, without using a custom renderer, to have IsTabStop=false when the children fit and have IsTabStop=true when the children do not fit (or have the ScrollView behave as if that is the case).