Change ToolBar Title dynamically on click events in Fragment on Xamarin android? - xamarin.android

First let me explain something, so you guys can understand better my problem:
I'm using Toolbar and i have a Fragment called Location Fragment where i have 6 floationg action button vertically .
When you click on one of the floating action button some action like geofence,live tracking,current location etc are performed on the same map fragment.
So my problem is that when i click any of the floation action button ,like when i click geo-fencing floation action button the title on the tool bar should change with the geofence title..In this way for all the Floating action button the title of toolbar should change. in my case the title of the tool bar is not changing .
I have tried to use setTitle or this.Activity.Title="Geo-fence" on the click method of Floating action button,but still it remains same title .

Change ToolBar Title dynamically on click events in Fragment
In your Fragment, add the following code in your click events :
((AppCompatActivity)Activity).SupportActionBar.SetTitle(Resource.String.YourTitle);

this.SupportActionBar.Title = "Your Title";

Related

How to make all activities(except MainActivity) have ActionBar/Toolbar at once with a title and a back button? (Xamarin.Android)

Yesterday I asked the same question but I forgot to say that it was for Xamarin.Android, not for Android(JAVA) (sorry about that) and the solution I got was for Android(JAVA) but I can't implement it on Xamarin.Android. I didn't delete the question, I left it just in case someone in the future needs it for Android, but I want to know the solution for Xamarin.Android.
I have the following MainActivity:
When I click on "Congreso" button the following activity appears:
And when I click on "Programa" button the following activity appears:
All activities except MainActivity have an action bar with a back button, a title of the activity aligned at the same place each time and the same color of the action bar. In my case I want the color to be blue. My question is, is there a way to set that behaviour on a single place in the application and it to apply to all the activities except for the MainActivity so that if some day I want to change the color of the action bar or the alignement of its title I don't have to go to all activities one by one and change it.
P.S.: I don't know if what is on the screenshots is an action bar or it is a toolbar. If you give me a solution with a toolbar it is OK too.

Show a popup from a popup in DNN

In DNN is it possible to navigate to a different popup control from another popup control?
I have a pop up edit control with some buttons. When I click on one of the buttons I would like to show a different edit control in the pop up window.
I have tried using this code in the button's click handler:
Response.Redirect(EditUrl("", "", "MyControlKey"))
but when I click the button Firefox shows a "Corrupted Content Error" in the pop up window.
Can this be made to work, and if so how?
Never mind I figured it out. This seems to do what I want:
Dim url = DotNetNuke.Common.NavigateURL("MyControlKey", $"mid={ModuleId}", "popUp=true")
Response.Redirect(url)

How to make the right hand button in a UIAlertController bold?

I have a requirement to make the right hand button in a UIAlertController bold and have both buttons side by side.
If I set the style of both buttons to .default it looks like this:
If I set the alert's preferredAction to be the settings alert action, then they layout turns to stacked:
I tried setting the style of the settings action to .cancel but it came out stacked again.
Without writing a custom alert controller, is there a way I can get the standard UIAlertController right button to be bold?
(Yes I am aware the standard action is that the Cancel button should be the one that should be bolded, I've had this argument with the UI designers many many times, they always want the right button bolded)

iOS get UINavigationBar's back button in order to set accessibility properties

I have a navigation controller stack where one of the views has a dynamic title.
The view controllers and their titles go like this:
Main --> ItemsTableView --> ItemDetails
Title:Main Title: NN Items Title: Details
Because the iOS UINavigationController sets the text of the "Back" button to be the title of the previous screen, the "Back" button on the details screen says "< NN Items" where NN is a dynamically changing number.
I'm trying to do some iOS UI automation, but the accessibility Label / ID of the back button is set by the system to it's button text. This means that the accessibility label of the back button on the details screen will change dynamically, and I can't find it from my scripts!
If I could get a reference to the UIBarButtonItem then I could easily set it's accessibilityLabel or accessibilityIdentifier from code to be a fixed string, however I can't figure out how to do this?
All of the stuff I've been able to find references setting the back button to a custom button via self.navigationItem.backBarButtonItem or similar, but when I read this property it's nil. I haven't been able to find out how to get access to the standard item without replacing it. I'd prefer not to replace the button if possible
This was bugging me as well. I've been writing Xcode 7 UI Tests and was trying to come up with a generic way of tapping on the back button without having to replace it with a custom button.
The following is how I solved this for Xcode 7 UI Tests - but you may also be able to apply this to UI Automation as well.
I discovered that (in terms of Xcode 7 UI Tests at least) the back bar button item that is created by the system consists of two buttons the entire thing is a button with an accessibility label of whatever the title of the button is, and then the arrow is also a button with an accessibility label of "Back".
Thus, as long as there aren't any other buttons on the screen that are identified as "Back", the back button can be accessed via the accessibility label of "Back". Like so in the case of UI Tests:
[[app.buttons matchingIdentifier:#"Back"] elementBoundByIndex:0]
Here I'm getting the first button that can be identified by "Back". I my case there could only ever be two such buttons - the arrow, or the whole back button itself (in the case where the back button's title is also "Back"). Since both of these buttons are essentially the same, just getting the first one it finds is sufficient.

Calling UIButton:setImage:forState makes button title disappear

If I call UIButton:setImage:forState then the title text of my buttons is disappearing (set via UIButton:setTitle:forState).
If I don't call setImage:forState then the title appears perfectly.
If I set the button images in interface builder then the title does appear, so why does setting the images programmatically cause the titel to vanish?
Instead of calling setImage:forState:, you should call setBackgroundImage:forState:.

Resources