I have a Xamarin Forms Shell app where I have implemented the Shell SearchHandler. The cancel button shows a book image.
This only occurs on iOS - on Android, there is no cancel button.
My xaml looks like this:
<Shell.SearchHandler>
<controls:RouteSearchHandler
x:Name="RouteSearch"
BackgroundColor="White"
ClearPlaceholderCommand="{Binding ClearSearch}"
ClearPlaceholderIcon="{StaticResource Cancel}"
DisplayMemberName="Street1"
SearchBoxVisibility="{Binding TopSearchVisibility, Converter={StaticResource visibleConvert}}"
ShowsResults="True" />
</Shell.SearchHandler>
How do I change the cancel icon from a book to another fonticon or image?
It seems a potential issue , the team set a default(book) icon on Clear button.
Workaround
You can prepare a small/transparent image and place it in Resources folder in iOS project , and set ClearPlaceholderIcon with it, then the problem should be solved .
And Feel free to file the feature request on github :https://github.com/xamarin/Xamarin.Forms/issues.
Related
I have set Window.SetSoftInputMode on AdjustResize in Android native project. However, only when a specific entry gets focus, I need to disable both page resize and scroll when keyboard is showed. How can I do this?
Do you want to set the Soft Keyboard Input Mode on Android device on xamarin form app?
If yes, you can set the Application.WindowSoftInputModeAdjust attached property to a value of the WindowSoftInputModeAdjust enumeration:
<Application ...
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:Application.WindowSoftInputModeAdjust="Resize">
...
</Application>
Alternatively, it can be consumed from C# using the fluent API:
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
...
App.Current.On<Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
For more, you can check: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/android/soft-keyboard-input-mode .
I have a weird issue with my UWP version of the xamarin forms project. The clicking is not working as expected. Sometimes no response when clicking items (button, image), and sometimes top items are opening when clicking an item.
Please watch this video for getting a clear idea. In this video, I am clicking the next button(Quiz page) several times, but no response. On the game page, the top item pages are opening when clicking an item. In android and ios, everything is working fine.
Version Details:
Xamarin Forms: 4.7.0.968
UWP target version: Windows 10, version 1903(10.0;Build 18362)
UWP Min version: Windows 10, Fall Creators Update(10.0; Build 16299)
Please help me to find the issue behind this. Thanks in advance.
Update
Button Code
<Button
Text="NEXT"
TextColor="White"
HorizontalOptions="EndAndExpand"
BackgroundColor="#f5c74c"
Clicked="NextButtonClicked"
WidthRequest="150"
HeightRequest="40"
FontSize="18"
BorderRadius="20"/>
public void NextButtonClicked(object sender, EventArgs args)
{
//action
}
I have solved this issue by updating the xamarin forms version to 4.8.0.1269.
I'm getting an issue I don't understand. I have a Button with an image defined with the following code :
<Button Image="SearchFilterIcon.png"
Grid.Row="0"
Grid.Column="1"
Clicked="OnButtonFilterClicked" />
This works well on Android. The image is displayed on my button but when I launch the Windows Phone application, I get a XamlParseException which says that : No Property of name Image found.
How is it possible? The Button widget isn't the same on Android and Windows Phone?
If you do the following:-
Button objButton1 = new Button();
objButton1.Image = (FileImageSource)ImageSource.FromFile("testImage1.png");
objStackLayout.Children.Add(objButton1);
this.Content = objStackLayout;
Then it will work (via code-behind).
The Button control always had the Image property, even in Xamarin.Forms v1.2.2x, so this is not a new property introduced and nothing to do with having the latest packages installed.
As a workaround perhaps you should consider giving the XAML Button a x:Name as in:-
<Button x:Name="myButton1"/>
And then assign the image from code-behind:-
myButton1.Image = (FileImageSource)ImageSource.FromFile("testImage1.png");
Update 1
This was a case of very old libraries being used (v1.0.6186). Once the project is reupdated to the latest binaries for v1.2.3x, then this works fine.
The Button.Image is available on WP, just as it is on iOS and Android. You probably don't have the latest nuget (1.2.3) installed for WP, or you have multiple versions installed.
The buttons in XAML for Windows Phone simply do not provide an Image property. Thus, you cannot add an image to the button as the API doesn't support this. What you have to do is to create a control template that contains the text and the image.
Button documentation
Try some like:
<Button Click="OnButtonFilterClicked">
<Button.Background>
<ImageBrush Stretch="Fill" ImageSource="/SearchFilterIcon.png"/>
</Button.Background>
</Button>
instead of "Clicked" and "image" properties.
When I run my app on an iphone, all the images come up great. But when I tried running it on an android, none of the images showed up at all. The images were placed in both the ios and android folders (Android/Resources/drawable).
Anyone know why the images don't appear on an android?
I solved this exact problem by loading the images in the code behind.
The only way downloaded or filesystem retrieved images outside of the projects namespace work in Xamarin.Forms for Android is in the codebehind. Binding to the ImageSource will not display them. The problem has something to do with OnAppearing never setting or refreshing the property even if you set WidthRequest and HeightRequest. I'm actually not sure why but I have tested this process for a couple of weeks with no success. What I mean by this is the ViewModel is where you retrieve the image from a WebService or from the Filesystem then get and set your ImageSource this code typically will run on creation of the ViewModel or OnAppearing. There is a bug in the system with XAML so it will never work. Using the Codebehind and setting it directly is the only way the images will display. I don't know why this behaves this way but I have tested every conceivable way to do this and it does not work with ImageCircle or Image whether you set the ImageSource.FromFile or ImageSource.FromStream. It does work when you set the ImageSource in the XAMLs code behind using the Image object directly. If you read through this article on Images in Xamarin Forms it will explain which ways you can use XAML and display the the images using Embedded Resources and using.
https://developer.xamarin.com/guides/xamarin-forms/working-with/images/
<Image Source="{local:ImageResource WorkingWithImages.beach.jpg}" />
The only runtime ImageSource binding that seems to work is using a web address and pulling from the URI.
<Image Source="https://xamarin.com/content/images/pages/forms/example-app.png" />
I have this add-on bar at the button of my firefox window where several buttons from extensions are shown. How can I add my own button there?
you can open the source code of that bar and add your own button
example (I'm on Windows right now):
C:\%AppData%\Roaming\Mozilla\Firefox\Profiles\PROFILEID.default\extensions\EXTENSION-TO-EDIT-FOLDER\chrome\content
A good way to do this is with the Add-on SDK. You can find documentation on adding an Add-on bar button here.
An additional benefit of using the SDK is that your add-ons won't require a restart after they are installed.
hey it is called a status bar and u should consider putting a statusbar xul element
e.g
<?xml version="1.0"?>
<overlay id="sample"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<statusbar id="status-bar">
<statusbarpanel id="my-panel" label="Hello, World" />
</statusbar>
</overlay>
For more details check this link statusbar attributes, methods and properties