SOLVED

DualScreenInfo.Current.PropertyChanged will not trigger and DualScreenInfo.Current will not updated

%3CLINGO-SUB%20id%3D%22lingo-sub-1170082%22%20slang%3D%22en-US%22%3EDualScreenInfo.Current.PropertyChanged%20will%20not%20trigger%20and%20DualScreenInfo.Current%20will%20not%20updated%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1170082%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20currently%20trying%20to%20update%20me%20existing%20app%20to%20use%20the%20new%20awesome%20NuGet%20package%20Xamarin.Forms.DualScreen.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20worked%20in%20most%20of%20the%20places%20but%20the%20event%20%3CEM%3EDualScreenInfo.Current.PropertyChanged%3C%2FEM%3E%20will%20not%20be%20valled%20and%20the%20values%20of%20%3CEM%3EDualScreenInfo.Current%3C%2FEM%3E%20will%20not%20be%20updated%20if%20the%20app%20changes%20from%20single%20pane%20to%20dual%20pane%20(wide)%20mode.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstead%2C%20only%20the%26nbsp%3BOnAppearing()%20method%20will%20be%20called%20if%20I%20drag%20and%20drop%20the%20app%20between%20the%20screens.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20know%20what%20I'm%20missing%20that%20this%20behavior%20happens%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1170082%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Equestion%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1170605%22%20slang%3D%22en-US%22%3ERe%3A%20DualScreenInfo.Current.PropertyChanged%20will%20not%20trigger%20and%20DualScreenInfo.Current%20will%20not%20upda%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1170605%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F348774%22%20target%3D%22_blank%22%3E%40tscholze%3C%2FA%3E%26nbsp%3BCan%20you%20try%20adding%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22c-mrkdwn__pre%22%20data-stringify-type%3D%22pre%22%3E%7C%20ConfigChanges.ScreenLayout%20%7C%20ConfigChanges.SmallestScreenSize%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3ETo%20your%20MainActivity%20on%20Android%3F%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20you'll%20basically%20have%20something%20like%20this%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3E%5BActivity(Label%20%3D%20%22Control%20Gallery%22%2C%20Icon%20%3D%20%22%40drawable%2Ficon%22%2C%20Theme%20%3D%20%22%40style%2FMyTheme%22%2C%0AMainLauncher%20%3D%20true%2C%20HardwareAccelerated%20%3D%20true%2C%20%0AConfigurationChanges%20%3D%20ConfigChanges.ScreenSize%20%7C%20ConfigChanges.Orientation%20%7C%20ConfigChanges.ScreenLayout%20%7C%20ConfigChanges.SmallestScreenSize)%5D%5D%0Apublic%20partial%20class%20Activity1%20%3A%20FormsAppCompatActivity%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1172340%22%20slang%3D%22en-US%22%3ERe%3A%20DualScreenInfo.Current.PropertyChanged%20will%20not%20trigger%20and%20DualScreenInfo.Current%20will%20not%20upda%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1172340%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F555448%22%20target%3D%22_blank%22%3E%40ShaneNeuville%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%2C%20thanks%2C%20it%20works%20now.%20I%20forgot%20two%20of%20the%20four%20Config%20values.%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

I'm currently trying to update me existing app to use the new awesome NuGet package Xamarin.Forms.DualScreen.

 

It worked in most of the places but the event DualScreenInfo.Current.PropertyChanged will not be valled and the values of DualScreenInfo.Current will not be updated if the app changes from single pane to dual pane (wide) mode.

 

Instead, only the OnAppearing() method will be called if I drag and drop the app between the screens.

 

Does anyone know what I'm missing that this behavior happens?

 

Thanks!

2 Replies
Highlighted
Best Response confirmed by tscholze (Contributor)
Solution

@tscholze Can you try adding 

| ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize


To your MainActivity on Android?

So you'll basically have something like this

[Activity(Label = "Control Gallery", Icon = "@drawable/icon", Theme = "@style/MyTheme",
MainLauncher = true, HardwareAccelerated = true, 
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]]
public partial class Activity1 : FormsAppCompatActivity
Highlighted

@ShaneNeuville 

Great, thanks, it works now. I forgot two of the four Config values. :)