Application title bar disappeared - UWP app - c#

I have na uwp app (published in Windows/Microsoft Store), and the app title bar is normally this:
I was doing some tests in my app (to test the fluent design system) and I made some changes and I did not notice, because now it appears like this:
The name of my app has disappeared and the ellipsis (...) that is included in the header of the page also does not appear.
How can I resolve this?

It happened to me too exactly when I was testing fluent design system!
To recreate the issue. Simply Add
// Extend acrylic
extendAcrylicIntoTitleBar(); to OnLaunched at App.xamel.cs
Then add following code to App.xamel.cs
/// Extend acrylic into the title bar.
private void extendAcrylicIntoTitleBar()
{
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
ApplicationViewTitleBar titleBar =
ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonBackgroundColor = Colors.Transparent;
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
}
Next you need to fix the missing using by hitting Ctrl + . key.
At this point the title bar disappear. Even removing the extendAcrylicIntoTitleBar() function will not solve the issue!
The title bar will appear again if I remove following
using Windows.UI;
using Windows.UI.ViewManagement;
using Windows.ApplicationModel.Core;
I am not sure if it is a issue. That seems to be the way fluent design works
Above test is done according to
https://learn.microsoft.com/en-us/windows/uwp/design/style/acrylic#acrylic-theme-resources

The last value is cached in the registry. Try deleting this:
[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\<GUID_PublisherID>\PersistedTitleBarData\<GUID_PublisherID>!App]
"AppVersion"=hex(b):00,00,00,00,00,00,01,00
"ExtendViewIntoTitleBar"=dword:00000001
Also saved nearby is last window position, and splash screen info.

Related

Keyboard not showing when being prompted by UITextField

In iOS 13.2, I'm noticing that my keyboard no longer shows up in my apps on the simulator and a real device. When I tap inside a UITextField, nothing happens but the cursor blinking inside the textfield. Is anyone else having this problem or know how to solve?
UPDATE
The problem originates from removing storyboard files and initiating a rootViewController programmatically
var windowScene = new UIWindowScene(session, connectionOptions);
Window = new UIWindow(windowScene);
Window.RootViewController = new ViewController();
Window.MakeKeyAndVisible();
After that, I just noticed the keyboard doesn't show again in a new project.
This looks like a bug when you try use a programatic approach to setting a rootViewController in the new SceneDelegate opposed to how we used to in AppDelegate.
I got around this by keeping the dumb storyboard which sets the rootViewController inside and keeping SceneDelegate.cs clean for the moment and my keyboard works again. Thanks for all your answers.
set textfiled delegate.
#IBOutlet weak var urlTextField: UITextField!
override func viewDidLoad() {
self.urlTextField.delegate = self // urlTextField it is your textfield outlet
}
If you delete this line of code, the keyboard does not appear, but if this exists, the keyboard does come up.
About simulator : You can check setting in iOS simulator firsrt .
Have a look at this screenshot ,be sure Use Hardware Keyboard not be selected . Or you can select it and unselect it again , then keyboard will show.
Restart app to check whether keyboard can be shown.

AcrUserDialogs Toast Position

I'm using AcrUserDialogs on a Xamarin project. My problem is that I need to display a toast in the top of the screen. By default they are displayed in the bottom. I see that AcrUserDialogs toasts have a ToastPosition setting but I can't seem to find how to initialize that:
UserDialogs.Instance.Toast("Awesome message to user.");
I even downloaded the AcrUserDialogs repository code but I'm just stuck on this one.
You need to set the DefaultPosititon property in the static class ToastConfig.
Acr.UserDialogs.ToastConfig.DefaultPosition = ToastPosition.Top;
Acr.UserDialogs.UserDialogs.Instance.InfoToast("I should be shown at the top");

LayoutParams change only takes effect in fullscreen

im using Xamarin with MvvmCross.
Ive done a FragmentDialog with a recyclerView inside, the list is populated via bindings on xml file, so i have no adapter and i should keep it this way.
If im not wrong, theres no built in way to make the recyclerView take only the size needed for its content, this should not be a problem, but in this case i need the list to start from bottom...
So i did this (its a custom fullscreen dialog) :
MvxRecyclerView list = Dialog.FindViewById<MvxRecyclerView>(Resource.Id.recyclerview);
list.LayoutChange += List_LayoutChange;
Then in layoutChange
private void List_LayoutChange(object sender, View.LayoutChangeEventArgs e)
{
MvxRecyclerView list = Dialog.FindViewById<MvxRecyclerView>(Resource.Id.recyclerview);
int itemHeight = list.GetChildAt(0).Height;
if (itemHeight != 0)
{
ViewGroup.LayoutParams prms = list.LayoutParameters;
prms.Height = itemHeight * list.GetAdapter().ItemCount;
list.LayoutParameters = prms;
list.LayoutChange -= List_LayoutChange;
list.RequestLayout();
}
}
That was working fine, the list get exactly the height needed and the list looks like it starts from bottom.
Now the client tell me that he doesnt like the fullscreen dialog and wants the status bar, i think that should be easy, just to remove this line at the dialog creation right?
dialog.Window.AddFlags(WindowManagerFlags.Fullscreen);
But looks like its not that easy, when the dialog its not fullscreen the layoutParams change seems to have no effect, it just dont do nothing.
My method is being called and i get the right item height, it just dont change the recyclerview height.
Notice that setting fullscreen at creation and clearing the flag after the recyclerview params change works
So looks like it only works during fullscreen mode.
Can someone throw some light at this?
Thanks in advance.
As you said, RecyclerView was not aware of its size.
Since last update to the support lib, it is !
http://android-developers.blogspot.fr/2016/02/android-support-library-232.html
The RecyclerView widget provides an advanced and flexible base for creating lists and grids as well as supporting animations. This release brings an exciting new feature to the LayoutManager API: auto-measurement! This allows a RecyclerView to size itself based on the size of its contents. This means that previously unavailable scenarios, such as using WRAP_CONTENT for a dimension of the RecyclerView, are now possible. You’ll find all built in LayoutManagers now support auto-measurement.
I would suggest to wait for the Xamarin wrapped lib (there is already a beta https://www.nuget.org/packages/Xamarin.Android.Support.v4/23.2.0-beta1)

How do I make a tray-icon-only C# application in MonoMac (no dock icon)?

I am trying to create an application that will have a tray icon only, and not appear in the taskbar. (similar to Dropbox) I need to create both Windows and Mac version of the application, so I tried using MonoMac to create the Mac front-end.
What is the best way to create a tray-only application in MonoMac?
All the resources I have found say to do one of two things:
Add <key>LSUIElement</key><string>1</string> to the Info.plist file.
Add the following code to the FinishedLaunching event in the AppDelegate class: NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Accessory;
I have tried all combinations of these two, but it seems that as soon as I try to instantiate a C# System.Timers.Timer, the icon reappears in the dock at the bottom of the screen. Am I missing something about how OSX handles background applications?
What am I doing wrong? Is there a better way to make a background application that has an upper tray icon but no bottom dock icon in OSX?
(This is very similar to this SO question, but that question was from a couple years ago and was never fully answered, so I'm hoping there might be a more complete answer out there.)
Here's the code I have so far:
public partial class AppDelegate : NSApplicationDelegate
{
MyServiceObject currentServiceObject;
public AppDelegate () { }
public override void FinishedLaunching (NSObject notification)
{
// Construct menu that will be displayed when tray icon is clicked
var notifyMenu = new NSMenu();
var exitMenuItem = new NSMenuItem("Quit My Application",
(a,b) => { System.Environment.Exit(0); }); // Just add 'Quit' command
notifyMenu.AddItem(exitMenuItem);
// Display tray icon in upper-right-hand corner of the screen
var sItem = NSStatusBar.SystemStatusBar.CreateStatusItem(30);
sItem.Menu = notifyMenu;
sItem.Image = NSImage.FromStream(System.IO.File.OpenRead(
NSBundle.MainBundle.ResourcePath + #"/notify-icon.icns"));
sItem.HighlightMode = true;
// Remove the system tray icon from upper-right hand corner of the screen
// (works without adjusting the LSUIElement setting in Info.plist)
NSApplication.SharedApplication.ActivationPolicy =
NSApplicationActivationPolicy.Accessory;
// Start running the program -- If I comment out then no dock icon appears
currentServiceObject = new MyServiceObject();
}
}
I found the problem, and it wasn't related to the application settings at all. Evidently, there are some operations that MacOS does not allow an 'Agent applications' to perform. As soon as one of those methods is called, the application is forced to appear in the dock. The code that was tripping up my application was a call to:
System.Windows.Forms.Cursor.Position.ToString()
Removing that line, and replacing it with the following MonoMac method allowed the application to remain hidden:
NSEvent.CurrentMouseLocation.ToString()
I was able to get this working by setting the value of "Application is agent (UIElement)" key to 1 in the info.plist file. Even though it should be a BOOL value, MonoDevelop makes it a string, but setting it to 1 seems to work. You can also set an empty string the for the "Icon file" but it's not necessary.

iPhone app InputAccessoryView isn't appearing on iPad

I'm using Monotouch to develop an app for the iPhone.
In my iPhone only app, I have an InputAccessoryView appear whenever the user selects a textfield. The accessory view provides buttons which aid the user (undo/redo etc).
It works fantastically on the simulator and on iPhone devices.
However, out of the blue, the Input Accessory View is not appearing on the iPad. I've made no changes to the code regarding the views; I've even rolled back to a version that I know displayed the accessory view correctly.
I was wondering if anyone else has come across this behaviour before / would know why this is happening?
EDIT
I've seen this accross all of my iphone projects running on the ipad. I made a fresh project which only contains 1 view, a UITextField and override the Input Accessory View and I'm still seeing nothing.
Code I'm using to test the override of the input view is:
public override UIView InputAccessoryView
{
get
{
UIView view = new UIView(new RectangleF(0,0,320,30));
view.BackgroundColor = UIColor.Blue;
return view;
}
}
Nothing too complex, on the iPhone just returns a blue bar above the keyboard.
I've reinstalled Mono, MonoDevelop, Monotouch and the iOS SDK multiple times to no avail. Apps that I've downloaded from the store still show the Input Accessory View, so I'm beginning to wonder if it's an issue with my Monotouch/iOS SDK combo? I'm using Monotouch 3.1.3 personal and 4.1 iOS SDK - version 2.6 of Mono. I'm going to try updating to version 2.8 of Mono.
The thing I don't understand is why it would work previously then all of a sudden just stop working?
When I'm deploying the code on the iPad, I'm selecting "Rebuild all", then uploading to the device. It doesn't matter if I pick either Release/Debug as a build, both yield the same result.
EDIT 2
If I subclass a UITextField and override the InputAccessoryView within that subclass, then the view appears on the iPad. This means that the InputAccessoryView which is being overriden in the View class isn't being assigned to the Textfield on the ipad.
EDIT 3
It would appear this is fixed in iOS 4.2 with Monotouch 3.2 !
My first suggestion is to reset the device in iTunes. You may have done so already, but just in case you did not, please do it first (since it's quick and easy to do).
If that didn't help: To identify if it is a problem with Monotouch and/or the iOS SDK could you repeat what you did above using only Cocoa Touch?
I.e., start a View-based app in XCode, add one UITextField in Interface Builder and connect it to the controller. Here is a corresponding Objective-C code to do it:
Instance variables in your controller (add to the #interface section in the <controllername>.h file):
IBOutlet UITextField *text;
UIView *accessory;
Hook up the UITextField in Interface Builder with the text outlet and then add the following implementation of viewDidLoad to the controller (the #implementation section in the <controllername>.m file):
- (void)viewDidLoad {
accessory = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
[accessory setBackgroundColor:[UIColor blueColor]];
[text setInputAccessoryView:accessory];
[super viewDidLoad];
}
If this displays the blue bar correctly, the problem is with the setup of Monotouch. If it does not, it is an issue with your device.
I had the same issue where a UITextView contained within a UIView would show the accessory bar on the simulator but not on the iPhone or iPad.
I'm doing some strange things with BeginFirstResponder to allow tapping anywhere in the larger parent area (containing a label and the text field) and activating the contained field and suspected this was involved. I added code in the parent UIView to override the InputAccessoryView and have it return the the value from the child UITextView and this fixed.
I suspect that Monotouch has an issue routing the event to the wrong object and my fix resolved it.
pseudo code:
public class ParentView : UIView
{
UILabel Label;
MyTextView Text;
/*Magic line here that fixed the problem */
public override UIView InputAccessoryView {get{return Text.InputAccessoryView;}}
}
public class MyTextView : UITextView
{
UIView Accessory;
public override UIView InputAccessoryView {get{return Accessory;}}
}
How are you showing your accessory view?
Can you try keeping a reference to the view?
Try this, and let me know if this fails:
public class Foo {
static UIView track;
}
And then when you create your view, stick it in that global:
Foo.track = new MyAccessoryView ()

Categories