Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaterialControls and WPF #42

Open
kineese opened this issue Feb 6, 2019 · 0 comments
Open

MaterialControls and WPF #42

kineese opened this issue Feb 6, 2019 · 0 comments

Comments

@kineese
Copy link

kineese commented Feb 6, 2019

Hey there,

first of all thanks for the Material Design controls! Due the possibility to generate a WPF application with Xamarin Forms I tried it out and got a weird behaviour when using the MaterialEntry: When I bind the the Text-Property of the MaterialEntry I get a Argumentexception "Width and height cant be a negative number". The same Exception occurs when just entering some text. Leaving out the binding works fine. I checked out the behaviour when using a normal Entry Control and it works fine. This problem only occurs on WPF. This is my xaml.

<ContentPage.Content>
        <StackLayout Orientation="Vertical" HorizontalOptions="CenterAndExpand" VerticalOptions="StartAndExpand"
                     Padding="16" Spacing="20" WidthRequest="250" BackgroundColor="{StaticResource PrimaryColorLight}">
            <Label Style="{StaticResource H5}" Text="{Binding Message}"
                   TextColor="{StaticResource PrimaryTextColor}" />
            <materialForms:MaterialEntry Text="{Binding Amount}" Placeholder="Anzahl"
                                         AccentColor="{StaticResource PrimaryTextColor}"
                                         Keyboard="Numeric" />
            <materialForms:MaterialPicker Items="{Binding Items}" SelectedItem="{Binding SelectedItem}"
                                          AccentColor="{StaticResource PrimaryTextColor}"
                                          Placeholder="Einheit" />
            <StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand">
                <materialForms:MaterialButton Text="ABBRECHEN" BackgroundColor="Transparent"
                                              TextColor="{StaticResource PrimaryTextColor}" Clicked="Abort"
                                              FontFamily="{StaticResource RobotoFontRegular}" HorizontalOptions="End" />
                <materialForms:MaterialButton Text="SPEICHERN" BackgroundColor="Transparent"
                                              TextColor="{StaticResource PrimaryTextColor}"
                                              FontFamily="{StaticResource RobotoFontRegular}"
                                              HorizontalOptions="End" Clicked="ExecuteAction" />
            </StackLayout>
        </StackLayout>
    </ContentPage.Content>

Here is the Stacktrace:

Unbehandelte Ausnahme: System.ArgumentException: Breite und Höhe dürfen keine negative Zahl sein.
   bei System.Windows.Size..ctor(Double width, Double height)
   bei Xamarin.Forms.Platform.WPF.FormsPanel.MeasureOverride(Size availableSize) in D:\a\1\s\Xamarin.Forms.Platform.WPF\FormsPanel.cs:Zeile 70.
   bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   bei System.Windows.UIElement.Measure(Size availableSize)
   bei System.Windows.ContextLayoutManager.UpdateLayout()
   bei System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   bei System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   bei System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   bei System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   bei System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
   bei System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   bei MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Windows.Threading.DispatcherOperation.Invoke()
   bei System.Windows.Threading.Dispatcher.ProcessQueue()
   bei System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   bei System.Windows.Application.RunDispatcher(Object ignore)
   bei System.Windows.Application.RunInternal(Window window)
   bei System.Windows.Application.Run(Window window)
   bei System.Windows.Application.Run()
   bei REA.MDE.Wpf.App.Main()

I know your controls are supposed to be used on Android iOS (and maybe UWP) but because they are based on the Entry-Control I gave it a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant