Hi All,
I want to write an event which will close the MasterDetailPage.
Currently there is a default back button which works correctly but I want to write a command which will close it.
I am wrapping a NavigationPage inside a MasterDetailPage.
Any help will will be highly appreciated.
Thanks In advance
How to close MasterDetailPage
The"ConvertResourceCases" task failed unexpectedliy
When I am building my project i am getting the above exception
"Java.Lang.IllegalStateException: Activity has been destroyed" when using AdMob
I have done some tests of how to use AdMob in Xamarin.Forms and I got stuck on this.
Scenario:
- A MasterDetailPage containing an empty master and a detail that is a new NavigationPage(myAdPage)
- Start the application
- Click on the (test)-ad and it will open a window
- Click on the hardware back button twice and you get Java.Lang.IllegalStateException: Activity has been destroyed
A simple solution is attached.
Any clues of what to change to avoid this crash?
What should I do in my lifecycle events?
So what should I be putting in OnResume, OnAppearing, OnDisappearing? A lot of people say "clean up" but Im not sure what that means. Ive seen other people say I should be unsubbing from events? I want to fool proof my pages and have ideal mem management. What are you guys using these events for? Are they safe to be used versus the native ones, because Ive also heard they can fire at weird and different times on the different platforms.
Weird Un-clickable Behavior for RadioButton
NOTE: I have tested it in a pure Xamarin Android project and its working as expected, so I hope if the administrator delete my post in Android forum.
Hi All,
I am using RadioButton widget as selection indicator only. I don't want it to be responsive to user input so I disable its clickable property to false. I will update its value through data binding from Xamarin Forms. However I got a weird behaviour as seen in pictures below. There are extra circles or shadows appeared around radiobutton. Any idea how to remove it? I tried ClearAnimation() but it did not work.
Updated States (with Clickable = true):
<-->
Updated States (with Clickable = false):
<-->
-K
App crashing on Windows Phone when deplyed in Release mode
Hi,
We have developed a Xamarin Forms app supporting Android, iOS and Windows Phone. The app is working on all three OS when deployed in Debug mode. It's also working on Android and iOS when deployed in Release mode. It crashes immediately after displaying Splash screen on Windows Phone 8.1/10 when deployed with Release mode but strangely all works fine when deployed using Debug mode.
Any idea from experts here?
Is there any way to get see the app log to diagnose the crash reason?
Thank you,
Deepak Sakpal
ListView ItemTemplate
i have list view and i defined 2 controls inside the item template (label and button),
scenario will be as the following:
- the label will display the name of customer,
- the button will display if the salesman did the visit for the customer (green button mean visit done, red mean not yet)
- when the visit done i have to register the date and time.
- other option i can click on the listview item and it will go to another modal page details about the customer i have selected
- this page contains details information and ability to make invoice or just end the visit
- end the visit from the second page will close it but it should change the button's color in list view for this customer.
my question is how can i access and reach the button to modify some of its properties.
when i take listview.selecteditem i get the object of datasource but i could not find the button.
so any suggestions about that?
How to focus the textbox inside the list view
Hi all,
I have a listview which contains a button and a textbox. When we click on button the text field should get focused.
But here iam getting error when try to access the button click event inside a list view in the code behind.
How can i implement this ?
Deserialize a String with XmlSerializer
Hi,
Im trying to deserialize the string with the following content:
"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<report>
<report-name name='Custom Adgroup Performance Report'/>
<date-range date='Mar 25, 2015-Mar 31, 2015'/>
<table>
<columns>
<column name='campaignID' display='Campaign ID'/>
<column name='adGroupID' display='Ad group ID'/>
<column name='impressions' display='Impressions'/>
<column name='clicks' display='Clicks'/>
<column name='cost' display='Cost'/>
</columns>
<row campaignID='268503015' adGroupID='19443549735' impressions='0' clicks='0' cost='0'/>
<row campaignID='268503015' adGroupID='19474365615' impressions='0' clicks='0' cost='0'/>
<row campaignID='268503615' adGroupID='19443569895' impressions='0' clicks='0' cost='0'/>
<row campaignID='268503615' adGroupID='19443570015' impressions='0' clicks='0' cost='0'/>
<row campaignID='268503615' adGroupID='19443570135' impressions='0' clicks='0' cost='0'/>
</table>
</report>"
This is my code:
The Problem is that I cant put my String directly into the Deserializer so I tried to go over XmlReader.
But this throws an Exeption "System.IO.DirectoryNotFoundException: Could not find a part of the path"
Does anybody know how to work with a string to deserialize?
`
XmlSerializer serializer = new XmlSerializer(typeof(Report));
XmlReaderSettings settings = new XmlReaderSettings();
var reader = XmlReader.Create(stringToDeserialize);
var list = serializer.Deserialize(reader);
[XmlRootAttribute(ElementName = "report")]
public class Report
{
[XmlElementAttribute("table")]
public ReportTable Table { get; set; }
}
public class ReportTable
{
[XmlElementAttribute("columns")]
public Columns Table { get; set; }
[XmlArray("row")]
[XmlArrayItemAttribute("campaignID")]
public string[] campaignID { get; set; }
[XmlArrayItemAttribute("adGroupID")]
public string[] adGroupID { get; set; }
[XmlArrayItemAttribute("impressions")]
public string[] impressions { get; set; }
[XmlArrayItemAttribute("clicks")]
public string[] clicks { get; set; }
[XmlArrayItemAttribute("cost")]
public string[] cost { get; set; }
}
public class Columns
{
[XmlArray("column")]
[XmlArrayItemAttribute("name")]
public string[] name { get; set; }
[XmlArrayItemAttribute("display")]
public string[] display { get; set; }
}
`
ContentView EventHandler not set correctly from XAML
I'm trying to set an event handler for an event in a ContentView from XAML, but it is always set to null. Setting the event handler from code works. Any suggestions on what I'm missing?
The XAML for the ContentView (MyView.xaml) :
<?xml version="1.0" encoding="UTF-8"?>
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ContentViewEventTest.MyView">
<Entry
Placeholder="Entry in ContentView..."
TextChanged="OnEntryTextChanged" />
</ContentView>
The Code behind for the ContentView (MyView.xaml.cs):
namespace ContentViewEventTest
{
public partial class MyView : ContentView
{
public MyView()
{
InitializeComponent();
}
public delegate void TextChangedDelegate(object sender, TextChangedEventArgs args);
public TextChangedDelegate TextChanged
{
get;
set;
}
void OnEntryTextChanged(object sender, TextChangedEventArgs args)
{
Debug.WriteLine($"[ContentView] OnTextChanged: {args.NewTextValue}");
if (TextChanged != null)
TextChanged(sender, args);
}
}
}
The XAML for the ContentPage (ContentViewTestPage.xaml):
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ContentViewEventTest"
x:Class="ContentViewEventTest.ContentViewEventTestPage">
<StackLayout VerticalOptions="Center">
<Entry
Placeholder="Entry in Page..."
TextChanged="OnTextChanged" />
<local:MyView
x:Name="_myContentView"
TextChanged="OnTextChanged" /> <!-- This does not work -->
</StackLayout>
</ContentPage>
The code behind for the ContentPage (ContentViewEventTestPage.xaml.cs):
namespace ContentViewEventTest
{
public partial class ContentViewEventTestPage : ContentPage
{
public ContentViewEventTestPage()
{
InitializeComponent();
// This works
// _myContentView.TextChanged += OnTextChanged;
}
void OnTextChanged(object sender, TextChangedEventArgs args)
{
Debug.WriteLine($"[ContentPage] OnTextChanged: {args.NewTextValue}");
}
}
}
Referencing System.xml.dll in portable project?
I'm trying to use System.Xml.Serialization.XmlSerializer.UnknownElement and other events in my portable project but VS wont let me add the dll. What's the trick?
How to consume SMP OData services in xamarin forms application?
We have a xamarin forms application for iOS, Android as well as Windows. Here we need to consume data from SMP OData services. Can anyone help us how to consume data from OData services in Xamarin forms.
Thanks,
Saju KS
MVVM and EventHandlers
I am looking for a best practice for handling events in an MVVM-compliant manner.
In particular, I am interested in the Completed event on an Entry control and how this can be translated to a Command or similar. I have seen from the Pre Release information that Xamarin 1.3 contains Trigger functionality - perhaps this would be a viable solution?
Thanks
Can we concatenate Binding with StringFormat in XAML?
Hello,
Can we concatenate Binding values with stringformat IN XAML?
For example:
<label Text={Binding Firstname, Binding Lastname, StringFormat='{0} {1}'}/>
Best regards
Hunting Memory Leaks, best practices?
Hi,
I started a new Thread because this Title makes more sense.
What are your best strategies to hunt down MemoryLeaks, especialls on Android? How can I check if a certain object get's relased? Does it make sense to include a Debug.WriteLine into the Destructor of the Class of interest?
Does it make sense to call GC.Collect to see if memory stays constant?
Thanks for all help!
Best
Thomas
Xamarin Forms 2.3.3.175 Scroll View Layer exceeds max. dimensions supported by the GPU
After upgrading Forms from 2.3.2.127 my app began to crash. After downgrading the Forms to 2.3.2.127 the issue went away, and I did try 2.3.3.168 and the issue happens there as well.
I have included a PCL test app that will recreate this issue if anyone has any idea as to what I could be doing wrong or some type of workaround that would be great.
Once you start the app you will notice the tab page shows up oddly, if you navigate to the menu and select any of the items the app will crash when it attempts to load that page and render the scroll view. You will also see this exception thrown java.lang.IllegalStateException: Unable to create layer for ScrollViewRenderer
Camera
Boa Tarde,
Alguém tem um código para ambas as plataformas, para acessar a câmera e salvar o array da imagem?
Forms Droid build causes System.OutOfMemoryException
We have a rather large project involving a number of external packages and components. During the droid build I've noticed a warning from the file "Xamarin.Android.Common.Targets"
Severity Code Description Project File Line Source Suppression State
Warning Exception of type 'System.OutOfMemoryException' was thrown.
at Microsoft.Cci.Pdb.MsfDirectory..ctor(PdbReader reader, PdbFileHeader head, BitAccess bits)
at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, BitAccess bits, Boolean readAllStrings)
at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Boolean readAllStrings)
at Pdb2Mdb.Converter.Convert(String filename)
at Xamarin.Android.Tasks.ConvertDebuggingFiles.Execute() ResponseGUI.Droid C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1550 Build
which points too:
<Target Name="_ConvertPdbFiles"
Inputs="@(_ResolvedPdbFiles)"
Outputs="@(_ResolvedPdbFiles->'%(RootDir)%(Directory)%(Filename).dll.mdb')"
DependsOnTargets="_CollectPdbFiles">
<ConvertDebuggingFiles Files="@(_ResolvedPdbFiles)" />
</Target>
How can i show a different page if the list is empty?
So i was wondering if I could show a different page with a label and button if the listveiw is empty in xaml. Any ideas?Thanks in advance.
Updating a listView on itemSource change
Hi I'm pretty new in the Xamarin Forms world and I'm trying to have the listView that I created refresh its content when the itemSource change. Right know I have this:
public NearMe ()
{
list=jM.ReadData ();
listView.ItemsSource = list;
listView.ItemTemplate = new DataTemplate(typeof(FilialeCell));
searchBar = new SearchBar {
Placeholder="Search"
};
searchBar.PropertyChanged += (sender, e) => {
TextChanged(searchBar.Text);
};
var stack = new StackLayout { Spacing = 0 };
stack.Children.Add (searchBar);
stack.Children.Add (listView);
Content = stack;
}
public void TextChanged(String text){
if (!String.IsNullOrEmpty (text))
text = text[0].ToString().ToUpper() + text.Substring(1);
var filterSedi = list.Where (filiale => filiale.nome.Contains(text));
List<Filiale> newList = filterSedi.ToList ();
newList = newList.OrderBy (x => x.distanza).ToList();
listView.ItemSource = newList;
}
But this is not working, it gives me a blank page at startup, there is no searchBar and neither the listView element. I think that I can't simply assign a new itemSource is this correct? How can I implement this feature? Thank you for your help in advance.