I have downloaded the sample ToDo List. There are many members in the folder. What member do I click to execute the sample?
Sample ToDo - Downloaded - How do I execute
WebView/HybridWebView Context Menu
Is there any way to show the context menu? especially ios.
do you have an idea or sample? can you please share?
Thanks
Unhandled Exception: Xamarin.Forms.Xaml.XamlParseException: Position 12:21. StaticResource not found
I'm trying to implement Rich Text box in xamarin forms. There is this exception occurring.
Unhandled Exception: Xamarin.Forms.Xaml.XamlParseException: Position 12:21. StaticResource not found for key FromRTFConverter occurred
This is my xaml code
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:demoapp"
xmlns:converters="clr-namespace:demoapp"
x:Class="demoapp.MainPage"
>
<StackLayout Orientation="Vertical">
<Label Text="Simple xamarin forms control" TextColor="Red" HorizontalOptions="Center" FontSize="Large"/>
<Entry />
<StackLayout>
<Picker x:Name="pickerDynamicData" Title="Select Country" HorizontalOptions="FillAndExpand" SelectedItem="{Binding Name}" SelectedIndexChanged="PickerSelection" HeightRequest="50" TextColor="Blue"/>
<Editor Text="{Binding CaretNote, Mode=OneWay, Converter={StaticResource FromRTFConverter}}" MinimumWidthRequest="250" HorizontalOptions="Fill" VerticalOptions="StartAndExpand" IsEnabled="False"/>
</StackLayout>
</StackLayout>
</ContentPage>
I tried to follow this example to solve the issue. So I made this changes in my XAML code
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:demoapp"
xmlns:converters="clr-namespace:demoapp"
x:Class="demoapp.MainPage"
>
<ContentPage.Resources>
<ResourceDictionary>
<converters:FromRTFConverter x:Key="FromRTFConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout Orientation="Vertical">
<Label Text="Simple xamarin forms control" TextColor="Red" HorizontalOptions="Center" FontSize="Large"/>
<Entry />
<StackLayout>
<Picker x:Name="pickerDynamicData" Title="Select Country" HorizontalOptions="FillAndExpand" SelectedItem="{Binding Name}" SelectedIndexChanged="PickerSelection" HeightRequest="50" TextColor="Blue"/>
<Editor Text="{Binding CaretNote, Mode=OneWay, Converter={StaticResource FromRTFConverter}}" MinimumWidthRequest="250" HorizontalOptions="Fill" VerticalOptions="StartAndExpand" IsEnabled="False"/>
</StackLayout>
</StackLayout>
</ContentPage>
But I get this exception
The type 'converters:FromRTFConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
This is my xaml.cs code
namespace demoapp
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
ObservableCollection<string> objStringList = new ObservableCollection<string>();
//Mostly below ObservableCollection Items we will get from server but here Iam mentioned static data.
ObservableCollection<PickerItems> objClassList = new ObservableCollection<PickerItems>();
objClassList.Add(new PickerItems { Name = "India" });
objClassList.Add(new PickerItems { Name = "Pakistan" });
objClassList.Add(new PickerItems { Name = "America" });
objClassList.Add(new PickerItems { Name = "London" });
objClassList.Add(new PickerItems { Name = "China" });
/*Here we have to assign service Items to one ObservableCollection<string>() for this purpose
I am using foreach and we can add each item to the ObservableCollection<string>(). */
foreach (var item in objClassList)
{
// Here I am adding each item Name to the ObservableCollection<string>() and below I will assign to the Picker
objStringList.Add(item.Name);
}
//Now I am given ItemsSorce to the Pickers
pickerDynamicData.ItemsSource = objStringList;
}
private void PickerSelection(object sender, EventArgs e)
{
var picker = (Picker)sender;
int selectedIndex = picker.SelectedIndex;
//put your code here
}
private void PickerSelection1(object sender, EventArgs e)
{
var picker = (Picker)sender;
int selectedIndex = picker.SelectedIndex;
//put your code here
}
private class StackEntry
{
public int NumberOfCharactersToSkip { get; set; }
public bool Ignorable { get; set; }
public StackEntry(int numberOfCharactersToSkip, bool ignorable)
{
NumberOfCharactersToSkip = numberOfCharactersToSkip;
Ignorable = ignorable;
}
}
private static readonly Regex _rtfRegex = new Regex(@"\\([a-z]{1,32})(-?\d{1,10})?[ ]?|\\'([0-9a-f]{2})|\\([^a-z])|([{}])|[\r\n]+|(.)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
/// <summary>
/// RTF reserved words
/// </summary>
private static readonly List<string> destinations = new List<string>
{
"aftncn","aftnsep","aftnsepc","annotation","atnauthor","atndate","atnicn","atnid",
"atnparent","atnref","atntime","atrfend","atrfstart","author","background",
"bkmkend","bkmkstart","blipuid","buptim","category","colorschememapping",
"colortbl","comment","company","creatim","datafield","datastore","defchp","defpap",
"do","doccomm","docvar","dptxbxtext","ebcend","ebcstart","factoidname","falt",
"fchars","ffdeftext","ffentrymcr","ffexitmcr","ffformat","ffhelptext","ffl",
"ffname","ffstattext","field","file","filetbl","fldinst","fldrslt","fldtype",
"fname","fontemb","fontfile","fonttbl","footer","footerf","footerl","footerr",
"footnote","formfield","ftncn","ftnsep","ftnsepc","g","generator","gridtbl",
"header","headerf","headerl","headerr","hl","hlfr","hlinkbase","hlloc","hlsrc",
"hsv","htmltag","info","keycode","keywords","latentstyles","lchars","levelnumbers",
"leveltext","lfolevel","linkval","list","listlevel","listname","listoverride",
"listoverridetable","listpicture","liststylename","listtable","listtext",
"lsdlockedexcept","macc","maccPr","mailmerge","maln","malnScr","manager","margPr",
"mbar","mbarPr","mbaseJc","mbegChr","mborderBox","mborderBoxPr","mbox","mboxPr",
"mchr","mcount","mctrlPr","md","mdeg","mdegHide","mden","mdiff","mdPr","me",
"mendChr","meqArr","meqArrPr","mf","mfName","mfPr","mfunc","mfuncPr","mgroupChr",
"mgroupChrPr","mgrow","mhideBot","mhideLeft","mhideRight","mhideTop","mhtmltag",
"mlim","mlimloc","mlimlow","mlimlowPr","mlimupp","mlimuppPr","mm","mmaddfieldname",
"mmath","mmathPict","mmathPr","mmaxdist","mmc","mmcJc","mmconnectstr",
"mmconnectstrdata","mmcPr","mmcs","mmdatasource","mmheadersource","mmmailsubject",
"mmodso","mmodsofilter","mmodsofldmpdata","mmodsomappedname","mmodsoname",
"mmodsorecipdata","mmodsosort","mmodsosrc","mmodsotable","mmodsoudl",
"mmodsoudldata","mmodsouniquetag","mmPr","mmquery","mmr","mnary","mnaryPr",
"mnoBreak","mnum","mobjDist","moMath","moMathPara","moMathParaPr","mopEmu",
"mphant","mphantPr","mplcHide","mpos","mr","mrad","mradPr","mrPr","msepChr",
"mshow","mshp","msPre","msPrePr","msSub","msSubPr","msSubSup","msSubSupPr","msSup",
"msSupPr","mstrikeBLTR","mstrikeH","mstrikeTLBR","mstrikeV","msub","msubHide",
"msup","msupHide","mtransp","mtype","mvertJc","mvfmf","mvfml","mvtof","mvtol",
"mzeroAsc","mzeroDesc","mzeroWid","nesttableprops","nextfile","nonesttables",
"objalias","objclass","objdata","object","objname","objsect","objtime","oldcprops",
"oldpprops","oldsprops","oldtprops","oleclsid","operator","panose","password",
"passwordhash","pgp","pgptbl","picprop","pict","pn","pnseclvl","pntext","pntxta",
"pntxtb","printim","private","propname","protend","protstart","protusertbl","pxe",
"result","revtbl","revtim","rsidtbl","rxe","shp","shpgrp","shpinst",
"shppict","shprslt","shptxt","sn","sp","staticval","stylesheet","subject","sv",
"svb","tc","template","themedata","title","txe","ud","upr","userprops",
"wgrffmtfilter","windowcaption","writereservation","writereservhash","xe","xform",
"xmlattrname","xmlattrvalue","xmlclose","xmlname","xmlnstbl",
"xmlopen"
};
/// <summary>
/// Special characters
/// </summary>
private static readonly Dictionary<string, string> specialCharacters = new Dictionary<string, string>
{
{ "par", "\n" },
{ "sect", "\n\n" },
{ "page", "\n\n" },
{ "line", "\n" },
{ "tab", "\t" },
{ "emdash", "\u2014" },
{ "endash", "\u2013" },
{ "emspace", "\u2003" },
{ "enspace", "\u2002" },
{ "qmspace", "\u2005" },
{ "bullet", "\u2022" },
{ "lquote", "\u2018" },
{ "rquote", "\u2019" },
{ "ldblquote", "\u201C" },
{ "rdblquote", "\u201D" },
};
/// <summary>
/// Strip RTF Tags from RTF Text
/// </summary>
/// <param name="inputRtf">RTF formatted text</param>
/// <returns>Plain text from RTF</returns>
public static string StripRichTextFormat(string inputRtf)
{
if (inputRtf == null)
{
return null;
}
string returnString;
var stack = new Stack<StackEntry>();
bool ignorable = false; // Whether this group (and all inside it) are "ignorable".
int ucskip = 1; // Number of ASCII characters to skip after a unicode character.
int curskip = 0; // Number of ASCII characters left to skip
var outList = new List<string>(); // Output buffer.
MatchCollection matches = _rtfRegex.Matches(inputRtf);
if (matches.Count > 0)
{
foreach (Match match in matches)
{
string word = match.Groups[1].Value;
string arg = match.Groups[2].Value;
string hex = match.Groups[3].Value;
string character = match.Groups[4].Value;
string brace = match.Groups[5].Value;
string tchar = match.Groups[6].Value;
if (!String.IsNullOrEmpty(brace))
{
curskip = 0;
if (brace == "{")
{
// Push state
stack.Push(new StackEntry(ucskip, ignorable));
}
else if (brace == "}")
{
// Pop state
StackEntry entry = stack.Pop();
ucskip = entry.NumberOfCharactersToSkip;
ignorable = entry.Ignorable;
}
}
else if (!String.IsNullOrEmpty(character)) // \x (not a letter)
{
curskip = 0;
if (character == "~")
{
if (!ignorable)
{
outList.Add("\xA0");
}
}
else if ("{}\\".Contains(character))
{
if (!ignorable)
{
outList.Add(character);
}
}
else if (character == "*")
{
ignorable = true;
}
}
else if (!String.IsNullOrEmpty(word)) // \foo
{
curskip = 0;
if (destinations.Contains(word))
{
ignorable = true;
}
else if (ignorable)
{
}
else if (specialCharacters.ContainsKey(word))
{
outList.Add(specialCharacters[word]);
}
else if (word == "uc")
{
ucskip = Int32.Parse(arg);
}
else if (word == "u")
{
int c = Int32.Parse(arg);
if (c < 0)
{
c += 0x10000;
}
outList.Add(Char.ConvertFromUtf32(c));
curskip = ucskip;
}
}
else if (!String.IsNullOrEmpty(hex)) // \'xx
{
if (curskip > 0)
{
curskip -= 1;
}
else if (!ignorable)
{
int c = Int32.Parse(hex, System.Globalization.NumberStyles.HexNumber);
outList.Add(Char.ConvertFromUtf32(c));
}
}
else if (!String.IsNullOrEmpty(tchar))
{
if (curskip > 0)
{
curskip -= 1;
}
else if (!ignorable)
{
outList.Add(tchar);
}
}
}
}
else
{
// Didn't match the regex
returnString = inputRtf;
}
returnString = String.Join(String.Empty, outList.ToArray());
return returnString;
}
public class PickerItems
{
public string Name { get; set; }
}
}
}
I don't have any clue how to fix this. Any suggestions?
How could I put sound of success in the QR code?
I would like that when scanning a code qr if it is correct you hear a correct sound or if you did not find a scanner one alert
I can not execute the sample of Hello, Android: Quickstart or Multiscreen
I have downloaded but Hello Android: Quickstart and Multiscreen. When I attempt to execute phoneword.sin I get message ONE OR MORE PROJECTS IN THESOLUTION WERE NOT LOADED CORRECTED. I get the same message from but the Quickstart and the Multiscreen Deep Dive. What must I do to get around this problem?
Is it possible to detect left swipe multi-touch with “two fingers” on Xamarin.Forms?
I want to detect left swipe with multi-touch within AbsoluteLayout. Is it possible to detect multi-touch with "two fingers" on Xamarin.Forms?
Here is SwipeGesture sample from Xamarin but its only detect direction of the swipe. (https://developer.xamarin.com/samples/xamarin-forms/WorkingWithGestures/SwipeGesture/)
In radio button control how to achieve Text before radio circle?
What I have
I want to achieve something like this:
How to get this kind design?
Any help regarding this appreciated.!
Thanks.
Forms project and obfuscation
I have some experience obfuscating Xamarin Android projects but I'm hitting a wall with Xamarin Forms. The linker does not accept the obfuscated DLL.
Has anyone gotten an obfuscator to work with Xamarin Forms? If so, which?
Thank you all.
Replacing the bubbling effect when rendering views by fading effect?
Usually when views are rendered, they show up instantly by going from opacity = 0% to 100% in 0 milliseconds, I want to override this behavior so the transition occurs smoothly, like when images are rendered, or when navigating between ContentView
s inside a ContentPage
, so my first attempt is to create a behavior like this:
public class FadingBehavior : Behavior<View>
{
protected override async void OnAttachedTo(View view)
{
//assuming that the view starts rendering from 0 opacity
await view.FadeTo(1);
base.OnAttachedTo(view);
}
protected override async void OnDetachingFrom(View view)
{
await view.FadeTo(0);
base.OnDetachingFrom(view);
}
}
but it doesn't work!
Application Using CouchbaseLiteDB and the SyncGateway,Sync is delayed when document size is more.
Hi Team,
We have an application which using couchliteDb to save the data as the Documents,But when the user make some changes to the Document and the size grows the sync to the database has been delayed more than 12 hours.How can we over come this issue?
Have any one come across the this issue, please suggest
FFImageLoading Plugin
Hi , I had use this plugin with my app downloading many photos from my web to the app phone, its works perfect.
My question is if I put all that photos in my resources folder its will work ok?? or maybe I will have a memory collapse ,, ?? the photos I have compressed to 45 kb each one, and I want to use my app out of internet.
But I've read that using the resource folder too much is not a good practice..
video minimize or overlay functionality in xamarin forms.
how can we achieve video minimize or video overlay functionality in xamarin forms. suggestion of any method or any NuGet package will be helpfull.
you can get some idea from above image
Different background colours for view cells in a ListView
I have a listview and I want to set two background colours for the cells in the listview like in the image below. How can I achieve this?
`
<ListView.ItemTemplate>
<ViewCell.View>
<Label VerticalTextAlignment="Center" Text="{Binding itemIdLastFour}" />
<Label VerticalTextAlignment="Center" Text="{Binding Item}" />
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>`
3D Touch in forms (including peek/pop!)
Had to get this feature working for a Forms app recently, here's how I did it.
https://www.openarc.net/our-blog/pro-tip-xamarin-forms-x-ios-3d-touch
Let me know if you have thoughts/suggestions!
How to open default contacts app in xamrin forms?
How to open default contacts app in xamrin forms?
Xamarin UWP Map is blank
my maps on UWP is blank, just a black screen with the zoom buttons. i have given capabilities, put the init codes in the UWP app.xaml.cs.
HELP
Issue creating APK in VS 2017
Hi,
My Xamarin.Forms app works in debug mode, but if I build in release mode and I try to create an APK from VS 2017, it doesn't work.
The build process succeeded but the APK is not yet created.
My Xamarin.Forms version is 3.4.0.1008975 and my VS is up to date.
Target Android version is 9.0.
Here above the application logs:
Xamarin.VisualStudio.Publishing.ArchiveManager|Error|0|System.NotSupportedException: This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.
at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.ObjectModel.ObservableCollection1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at Microsoft.VisualStudio.PlatformUI.HierarchyItem.HierarchyItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection
1.InsertItem(Int32 index, T item)
at System.Collections.ObjectModel.Collection1.Add(T item) at Microsoft.VisualStudio.PlatformUI.HierarchyItem.AppendChildren(IVsHierarchy hierarchy, UInt32 itemID, List
1 appendedChildren)
at Microsoft.VisualStudio.PlatformUI.HierarchyItem.FillChildren()
at Microsoft.VisualStudio.PlatformUI.HierarchyItem.get_InternalChildren()
at Microsoft.VisualStudio.PlatformUI.HierarchyItem.get_Children()
at Clide.SolutionExplorerNode.get_Nodes() in E:\A_work\184\s\src\Clide\Solution\SolutionExplorerNode.cs:line 166
at Clide.ITreeNodeExtensions.<>c.b__1_0(ISolutionExplorerNode x) in E:\A_work\184\s\src\Clide.Interfaces\Extensions\ITreeNodeExtensions.cs:line 33
at Traverser.d__21.MoveNext() in E:\A\_work\184\s\src\Clide.Interfaces\Extensions\Traverser.cs:line 70 at System.Linq.Enumerable.<OfTypeIterator>d__95
1.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Clide.AndroidClideExtensions.GetAndroidResources(IProjectNode projectNode) in E:\A_work\293\s\src\Core\VisualStudio.Android\ProjectSystem\Extensions.cs:line 128
at Xamarin.VisualStudio.Android.Publishing.AndroidArchiveToolsService.CreateParameters(IProjectNode project) in E:\A_work\293\s\src\Core\VisualStudio.Android\Services\Publishing\Archival\AndroidArchiveToolsService.cs:line 186
at Xamarin.VisualStudio.Android.Publishing.AndroidArchiveToolsService.ArchiveAsync(IProjectNode project, IProgressReport progress, CancellationToken cancellationToken) in E:\A_work\293\s\src\Core\VisualStudio.Android\Services\Publishing\Archival\AndroidArchiveToolsService.cs:line 113
at Xamarin.VisualStudio.Publishing.ArchivableProjectBase.d__8.MoveNext() in E:\A_work\293\s\src\Core\VisualStudio.Publishing\Archival\ArchivableProjectBase.cs:line 30
--- End of stack trace from previous location where exception was thrown ---
Data from Api not binding to custom entry field properly
I have multiple fields in a section of my page such as amount, tax, Gross Total. I am getting data from api and binding the data from code behind (NOT using MVVM). Sometimes values are binding correct and sometimes incorrect values are binding to it. I am unable to understand exactly what is the problem. Values from api are always correct i have tested on postman.
Code -
XAML-
Code Behind-
Total.Text = result.Total.ToString();
Correct value of total is suppose - 8500/-
sometimes it is correct displayed as 8500/- but sometimes it displays 6500/-, sometimes 7500/-.
Can anybody suggest any solution.
Thank you.
Geting the value of a Picker in Xamarin Forms
How can i get the value of any Picker, is there any property like .Value or .selectedValue? or how can i achieve this in xamarin forms? or do i have to binding an object with BindingContext and get the index of the value and convert it to a string object?
How to Use Navigation Push ASync in Master Detail Page Menu
I want to make my xamarin forms app when the menu item is clicked instead change the master detail page it go to another page and shows navigation bar with back button in the top. but i got confused in how to change the on menu item selected, here is my onmenuitemSelected
private void OnMenuItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var item = (DrawerItem)e.SelectedItem;
Type page = item.TargetType;
//Navigation.PushAsync((Page)Activator.CreateInstance(page));
//new NavigationPage((Page)Activator.CreateInstance(page));
Detail = new NavigationPage((Page)Activator.CreateInstance(page));
IsPresented = false;
}
As you can see in the comment tag i already try to do Navigation.Push async and tried New NavigationPage only without Detail but when im click the menu item its do nothing, so what code should i write to do that.