MvxException at Windows Phone by Rio-Binding - windows-phone-8

I have some troubles to bind my methods from the ViewModel to the XAML of Windows Phone.
This problem occours not at compiling time self but at the execution in this line of code:
System.Windows
.Application
.LoadComponent(this,
new System.Uri("/MvvmCross.Phone;component/Views/MenuAuswahlView.xaml"
, System.UriKind.Relative));
and the XAML looks like:
...
xmlns:mvx="clr-namespace:mvx;assembly=Cirrious.MvvmCross.BindingEx.WindowsPhone"
...
<Button mvx:Bi.nd="Command SelectOrder">
...
Does anybody have an idea?

Related

VisualStateManager with Windows Phone 8.1 BottomAppBar

I'm using VisualStateManager in a Windows 8.1 app to update the visibility of buttons on the BottomAppBar...
However this same XAML appears to not be supported for the BottomAppBar on Windows Phone 8.1.
When I attempt to update a button in Blend I get the error: An animation is trying to modify an object named '', but no such object can be found in the PageStandIn.
Is there a way to make this work or will I have to use code-behind to toggle the visibility manually?
is there any way to make this work so I can share the code from win81 to update the command bar?
The AppBars are very special, they are part of the System UI (in some sense) and thus somethings tend not work as expected.
Using storyboards don't work for updating them.
You can use the code behind, but if you are using an MVVM framework you should be able to Bind them to a Boolean and using a BooleanToVisibilityConverter to do the visibility management.
Model
public bool ShowAppButton {get; set;}
View
<AppBarButton x:Name="MyAppButton" Label="AppButton" Visibility="{Binding ShowAppButton, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
Hope this helps!

Bind Pivot SelectedIndex causes app random crash Windows Phone 8.1 Universal app

I have an universal app for WP 8.1 with a page and a Pivot in it. The "SelectedIndex" property of the pivot is bind to a property in the VM like this:
public object SelectedPivotIndex
{
get { return this.selectedPivotIndex; }
set
{
if (this.selectedPivotIndex == value) return;
this.selectedPivotIndex = value;
RaisePropertyChanged(() => SelectedPivotIndex);
}
}
Page code:
<Pivot x:Name="ContentPivot"
x:Uid="ContentPivot"
SelectedIndex="{Binding SelectedPivotIndex, Mode=TwoWay}"
>...</Pivot>
The problem is from time to time i'm having app crash (in App.xaml.cs): "Unhandled exception" with type "COMEXCEPTION". This crash stop if I remove the bind of the "SelectedIndex" in the xaml, but I cannot understand why it ocurs. Sometimes even the debugger is not shown and the app closes without any error information.
BTW I'm using MVVM Light, so the "glue" between the view (page) and the VM is set in the page:
<Page
...
DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
>
EDIT:
I'm able to reproduce the crash with this behavior: Open app, navigate to another page, come back to the pivot page (several times) and flip throught the pivotitems.
I have had the same issue. Solved it by hadling the selected changed event instead. Not a solution but a workaround.

How to use CoreCursor class in UniversalApp WindowsPhone

I have used the following code
Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 1);
to get the cursor and it working fine in UniversalApp WinRT (Windows). But it not working in UniversalApp WindowsPhone, When i using above line in UniversalApp WindowsPhone it gives the exception for "The method or operation is not implemented".
Can any one help me ho how to achieve this in UniversalApp WindowsPhone ?
Yep. That's because there is, basically, no cursor on the phone.
#if WINDOWS_APP
// Cursor Code
#else
// Alternate Code
#endif
Best of luck

Share Target and JumpListItemBackgroundConverter

I've added the Share Target declaration to my app for the data format WebLink and everything works as expected. However, when I add a JumpListItemBackgroundConverter or JumpListItemForegroundConverter anywhere in the app, the app hangs on the splash screen when you enter the app using the Share from IE. No exception, no crash, the debugger doesn't even stop. All I get is a cryptic error in the output window, "The program '...' has exited with code -1073741819 (0xc0000005) 'Access violation'." The documentation for those converters say they're fine with universal apps, just that they've been moved to a different namespace. Has anyone been able to get these two things to work in the same app? If so, where did I go wrong? Or is there something better than those two converters to get the LongListSelector look and feel?
Steps to reproduce:
Create a new universal app. I chose hub.
Add a share target of format WebLink to the appxmanifest declarations.
Add a new page to point the share contract to.
Add the OnShareTargetActivated code to app.xaml.cs to open the new page. See code below
Add a JumpListItemBackgroundConverter to the resources of the main page of the app. You don't need to apply it to anything, just declaring it is enough to break the sharing.
Go to IE and share a link. It should hang on the splash screen.
Code for app.xaml.cs:
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
// Replace SharePage with the name of the share target page
var rootFrame = new Frame();
rootFrame.Navigate(typeof(SharePage), args.ShareOperation);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
It turns out this is a bug in the emulator. It works if you test on a physical device.
MSDN Forum - JumpListItemBackgroundConverter and Share Target in Windows Phone 8.1

Windows phone 8 Performance progressbar

Do i need to use performance progressbar in windows phone 8. In my windows phone 7/7.5 application i was used the progressbar shipped with the toolkit(performance progressbar). Is it necessary to use the same in windows phone 8 or simple progress bar is sufficient?
The WP8 SDK contains the improved progress bar now. So use this one only.
The TK version in not working properly anymore on WP8.
See changes for the SDK here, including a sentence about the progress bar:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206940%28v=vs.105%29.aspx
See a discussion about that topic here:
http://social.msdn.microsoft.com/Forums/en-GB/wpdevelop/thread/dd457734-a11a-48e2-8443-ba8f5e3f67ac
Use the WP8 SDK's progress bar, but don't forget to set IsIndeterminate = false after collapsing the progressbar. It will run in the background & use battery & UI thread cycles even though its collapsed! :(
I think you should use something like this when targeting WP7 and WP8 with linked files:
#if WP8
public class MyPerformanceProgressBar : ProgressBar
{
}
#else
public class MyPerformanceProgressBar : Microsoft.Phone.Controls.PerformanceProgressBar
{
}
#endif
and use the class MyPerformanceProgressBar in your XAML code (which is linked in WP7 and WP8 project).