Am new to Xamarin and am using Xamarin forms to build a cross platform app. I'm trying to find out how to use a Editor (Text area) inside a Table View cell. I tried to google, but could not find out any solution. Can you pls help me with the code snippet for the same.
I thought I can create a custom renderer for an EntryCell, and try to customize height and enable multi line, but am not able to find out the properties to use, to maniupulate height and multi line.
If there is any other good way, pls let me know. Thanks always!!
I think you are mixing a few concepts, UITableViewCell is not in Xamarin.Forms but Xamarin.iOS. In Xamarin.Forms you have the ListView which contains ViewCells.
What you are trying to do is a Custom ViewCell and use the Editor Control which by default allows multiline input.
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout BackgroundColor="#eee"
Orientation="Vertical">
<Editor BackgroundColor="#a4eaff" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
More about the Editor Control here.
Related
I have built a UWP app through unity using the UWP build settings and I would like to incorporate WinUI controls into the app. I have installed the required packages through Nuget, but the WinUI controls do not appear in the XAML designer. However, once I build and run the app, the WinUI controls are displayed. This is honestly not that much of a problem since at the moment the app is simple and I dont mind building each time to check the controls, but I have plans to expand the app and at that point I fear that the development pace would be hampered.
To test the problem, I have built a separate app through visual studio to make sure that it works, and indeed there are no problems and all the WinUI controls appear on this app. I have also made sure that I have the same version of the Microsoft.XAML.UI pacakge and that the target platforms and all other settings are identical.
I have attached an image below of me trying to add a colorpicker control to the project but it is not showing up in the XAML designer.
Image of xaml designer not displaying controls
I would like to also note that I get an error on my xaml stating:
Type Microsoft.UI.Xaml.Controls.ColorPicker cannot be created in XAML. Building the project may help
And here is the xaml code:
<Page
x:Class="Croissant.MainPage"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Croissant"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
Background="#FFFFFF">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<SwapChainPanel Grid.Row="0" x:Name="m_DXSwapChainPanel">
<Grid x:Name="m_ExtendedSplashGrid" Background="#FFFFFF">
<Image x:Name="m_ExtendedSplashImage" Source="Assets/SplashScreen.png" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
</SwapChainPanel>
<muxc:ColorPicker Grid.Row="1"/>
</Grid>
Thank you so much in advance for your help and advice!
I am using syncfusion xamarin form button control on my project, the click event didn't fire on the IOS simulator but fired on both my IPHONE and IPAD. anyone experienced this issue?
the XMAL is attached below,
<buttons:SfButton Padding="10"
x:Name="btnCamera"
Grid.Column="1"
IsCheckable="False"
BackgroundColor="White"
BorderColor="Transparent"
BorderWidth="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Clicked="btnCamera_Clicked"
HasShadow="True"
CornerRadius="20">
<buttons:SfButton.Content>
<Image Source="Camera.png"
HeightRequest="45"
WidthRequest="45"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</buttons:SfButton.Content>
</buttons:SfButton>
<buttons:SfButton Padding="10"
x:Name="btnImageFolder"
Grid.Column="3"
IsCheckable="False"
BackgroundColor="White"
BorderColor="Transparent"
BorderWidth="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Clicked="btnImageFolder_Clicked"
HasShadow="True"
CornerRadius="20">
<buttons:SfButton.Content>
<Image Source="ImageFolder.png"
HeightRequest="45"
WidthRequest="45"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</buttons:SfButton.Content>
</buttons:SfButton>
Query: StackOverflow : syncfusion xamarin form button control, click event not fired on IOS simulator but fired on my IPHONE
We are unable to replicate the reported issue on our side. We are prepared a sample based on the provided code snippet since the ButtonClick event is properly called on our side. We have prepared a sample and video for your reference. Sample
Please make sure you have added SfButtonRenderer for iOS in the AppDelagates.cs file. Refer to the below link,
Link: https://help.syncfusion.com/xamarin/button/gettingstarted#additional-step-for-ios
Please check and let us know once the problem was resolved on your side.
Regards,
Ruba Shanmugam
The code below when entered in AppShell for Xamarin Forms only works in Android. In iOS the Switch is rendered but can't be toggled (as if it is disabled). Are there any tricks to making this work in iOS as well or is this a bug?
I tried placing the the Switch in a completely different ContentView and loading it in the Shell with local: and also tried including the Switch in the DataTemplate directly. All of them work in Android, just not iOS.
Thanks for your help
<MenuItem>
<Shell.MenuItemTemplate>
<DataTemplate>
<ContentView>
<Switch IsToggled="True" />
</ContentView>
</DataTemplate>
</Shell.MenuItemTemplate>
</MenuItem>
I have some icons on my xamarin forms project. I need a circle background for my icon. See the screenshot below:
I tried Xam.Plugins.Forms.ImageCircle plugin and tried Framelayout. Imagecircle plugin only cropping the icon and Framelayout gives a rounded corner layout. Nothing gives me a perfect circle background. I go through the FFImageloading documentation, but which is also the same as Imagecircle plugin.
Image code
<Image
Source="ic_group_fill_xx.png"
WidthRequest="25"
HeightRequest="25"/>
Is there any way to achieve this feature?
I usually prefer to make an icon that by default has a circle in it, doesn't make sense to add extra code for something that can be done for free.
There is great document by Android on working with Images for Android applications which can be found here, you can also use Android Asset Studio for creating awesome images.
I normally use an ImageButton for this (and because of the clicked property you don't need to use Gesture Recognizers for detecting taps)
The code below gives me a perfect circle on Android & iOS
<ImageButton Source="icon_name"
BackgroundColor="Blue"
HeightRequest="60"
WidthRequest="60"
CornerRadius="30"
Padding="15"
Clicked="Btn_Clicked" />
The image below is from my app, the image button is inside AbsoluteLayout and the icon is 64x64
Use the ImageCircle.Forms.Plugn plugin which I am already using it,
Import namespace like below,
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"
And use the image control like below sample,
<controls:CircleImage
Source="{Binding ProfileImage}"
HorizontalOptions="Start"
VerticalOptions="Center"
WidthRequest="40"
Aspect="AspectFill"
BorderColor="#B8BCC9"
BorderThickness="1"
HeightRequest="40" />
I'm using WP7 'Mango' SDK and Phone Toolkit for my app. I have a control, which contains ExpanderView. I'm using next template for ExpanderView's header:
<toolkit:ExpanderView.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}"/>
<Button Tap="ShowMoreTap">
<Button.Template>
<ControlTemplate>
<TextBlock Text="show more..."/>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</DataTemplate>
</toolkit:ExpanderView.HeaderTemplate>
The code behind:
private void ShowMoreTap(object sender, System.Windows.Input.GestureEventArgs e)
{
// Some logic here
}
I don't want to expand/collapse the ExpanderView when user taps on the button, I need some specific actions there. The problem is that ShowMoreTap event is never fired.
Any ideas?
Thanks
According to the source code the Tap is handled by the ExpanderView to cause the expansion (or collapse)
Apparently this event then never bubbles up; it is not a routed event.
I see two options:
using the source code from codeplex make a customized version of the ExpanderView or
stop using the ExpanderView because you do not want to expand anything. You could probably switch to another control that you style similarly more easily. Remember: do not use a control because it looks the way you want it, use it because it has the properties and behavior you need. WP7 allows you to style any control.