softlion / WheelPicker-Samples

WheelPicker control samples for .NET8 / Maui
17 stars 5 forks source link

Error RowHeight setter is missing #3

Closed Mythikos closed 6 years ago

Mythikos commented 6 years ago

I was attempting to set the RowHeight on the wheel definition and it resulted in an error saying the row height setter is missing. I attempted to do it with both XAML and C# on the portable project. If it helps, I grabbed the libraries from the nuget package.

Attempts:

    this.cmbPlayers.WheelDefinitions = new List<WheelDefinition>
    {
        new WheelDefinition
        {
                RowHeight = 20,
                Alignment = Vapolia.WheelPickerCore.WheelItemAlign.Center,
                HorizontalOptions = Vapolia.WheelPickerCore.WheelItemAlign.Left,
                Width = GridLength.Auto
         }
    };

and

<wp:WheelPicker.WheelDefinitions>
    <wp:WheelDefinition Width="Auto" HorizontalOptions="Left" Alignment="Center" RowHeight="20">
    </wp:WheelDefinition>
</wp:WheelPicker.WheelDefinitions>

As a side note: Will you eventually be updating the Xamarin component with the new version? The version I purchased on Xamarin doesn't even have the RowHeight property, which I really need as I have font size requirements.

softlion commented 6 years ago

Hi Mythikos,

For your issue I don't have this issue. What version are you using ? Are you using the nuget private server ?

For your side note you received a welcome email with new credentials to access the private nuget server with non-trial versions of the library, which do have the latest features.

The component store is sunsetting, and will be closed in a very short time, maybe at the end of the year. The component store "folder" has been removed from Xamarin projects that don't have components in Visual Studio 15.5, which just released.

Please remove the component, and use the private nuget server as explained in the welcome email. There is very little chance that we and the component store invest time in respectively updating the component and accepting component updates for a store scheduled to die in a short time.

Mythikos commented 6 years ago

The version I was attempting to use was 2.1.0 on the public nuget site: https://www.nuget.org/packages/Vapolia.WheelPicker.Free/2.1.0.

I didn't realize there was a private nuget server, it looks like the welcome email went straight to my spam folder. Ill give that a shot.

Mythikos commented 6 years ago

Something doesn't seem right on the private nuget. It looks like I receive a 403 error when attempting to pull Vapolia.WheelPicker.Forms (which is what I actually bought) or Vapolia.WheelPicker, but I am able to download Vapolia.XamSvg.Forms.

It seems like I was given access to the wrong nuget package.

softlion commented 6 years ago

Vapolia.XamSvg is for customers of the XamSvg component. Are you interested in it ? Without a license, the server will return 403 unauthorized for unauthorized nugets.

Mythikos commented 6 years ago

I realize it's for XamSvg. I purchased the wheel picker for xamarin forms. I don't have a need for an svg component at this time. Is there a way you guys can fix the license on your end so I can get the wheel picker not the svg component. I'd be happy to provide a copy of the invoice if that helps.

Mythikos commented 6 years ago

With the issue in the private nuget server resolved, I attempted to use the RowHeight setter and it is still returning a missing method exception. I am using version 2.1.0

Error:

Unhandled Exception:
System.MissingMethodException: Method 'Vapolia.WheelPickerForms.WheelDefinition.set_RowHeight' not found. occurred

Unhandled Exception:
System.MissingMethodException: Method 'Vapolia.WheelPickerForms.WheelDefinition.set_IsCircular' not found. occurred

Code Snippet:

this.cmbPlayers.WheelDefinitions = new List<WheelDefinition>
            {
                new WheelDefinition
                {
                    Alignment = Vapolia.WheelPickerCore.WheelItemAlign.Center,
                    HorizontalOptions = Vapolia.WheelPickerCore.WheelItemAlign.Center,
                    Width = GridLength.Auto,
                    RowHeight = 25,
                    IsCircular = true
                }
            };

Any ideas what might be going on?

softlion commented 6 years ago

If you have set "Linking" to "Full", change it to "SDK Only" or "None". It seems the linker you are using is removing the method. Are you using the latest Visual Studio / Xamarin version ?

Mythikos commented 6 years ago

I'm using visual studio 2017, xamarin version 2.5.0.19275-pre2. Linking is currently set to none.

softlion commented 6 years ago

Could you delete the obj and bin folders and retry ?

Mythikos commented 6 years ago

I deleted the obj/bin folders and attempted to run it. No errors were produced however the wheel picker isnt showing up anymore in the app. It looks like it may be related to the following console output:

2>D:\Users\pntbl\Documents\Visual Studio 2017\Projects\***\***\***.Android\***.Android.csproj : warning XA0105: The $(TargetFrameworkVersion) for Vapolia.WheelPickerDroid.dll (v8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project.
2>D:\Users\pntbl\Documents\Visual Studio 2017\Projects\***\***\***.Android\***.Android.csproj : warning XA0105: The $(TargetFrameworkVersion) for Vapolia.WheelPickerForms.Droid.dll (v8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project.

Does the control only work with android version 8? My requirement is version 7.1.1, do you perhaps have a version that works with android 7.1.1?

softlion commented 6 years ago

The target framwork is not the Android version. You need to upgrade your Android SDK to download the latest api version. Then in your projet, set to use the latest target version. Set the minimum target version to the first Android version you need to support. Like 4.3

Mythikos commented 6 years ago

So I downloaded the latest API, set my project to use latest version, and set the minimum target as 7.0. The control was still not visible in the app. So as a sanity check, I created a blank xamarin forms app, and followed the get started page on xamarin components and the control is still not showing up. So as an additional sanity check, I uninstalled/reinstalled the entire android sdk, java sdk, and android studio. Project built perfectly, no errors or warnings, but alas, the wheel picker is still not visible in the app.

Any idea what I could look at next? Below is my code usage, do you spot anything wrong? Perhaps I am about at the stage where a hackhands remote-in might be in order. Let me know what you think.

xmlns:wp="clr-namespace:Vapolia.WheelPickerForms;assembly=Vapolia.WheelPickerForms"
...
                    <wp:WheelPicker Grid.Column="0" Grid.Row="1" x:Name="cmbPlayers"
                           Margin="30, 0, 30, 0"
                           BackgroundColor="Red"
                           ItemTextFont="{Binding ItemTextFont}"
                           ItemsSourceSimple="{Binding ItemsSource}" 
                           Command="{Binding ItemSelectedCommand}" 
                           SelectedItemsIndex="0"
                           HorizontalOptions="Fill"
                           SelectedItemIndexChanged="CmbPlayers_SelectedItemIndexChanged">
                    </wp:WheelPicker>
using Vapolia.WheelPickerForms;
...
            this.cmbPlayers.BindingContext = new DemoViewModel(_BatterInfoList);
            this.cmbPlayers.WheelDefinitions = new List<WheelDefinition>
            {
                new WheelDefinition
                {
                    Alignment = Vapolia.WheelPickerCore.WheelItemAlign.Center,
                    HorizontalOptions = Vapolia.WheelPickerCore.WheelItemAlign.Center,
                    Width = GridLength.Auto
                }
            };
...
    public class DemoViewModel
    {
        // Wheel picker related
        public List<string> ItemsSource { get; } = new List<string>();
        public Command ItemSelectedCommand { get; }
        public Font ItemTextFont { get; }

        public DemoViewModel(List<BatterInfo> BatterInfoList)
        {
            // Wheel picker related
            ItemsSource.Add(string.Format("{0}, {1}", Info.PlayerLastName, Info.PlayerFirstName));

            ItemSelectedCommand = new Command<Tuple<int, int, IList<int>>>(tuple =>
            {
                var selectedWheelIndex = tuple.Item1;
                var selectedItemIndex = tuple.Item2;
                var selectedValue = ItemsSource[selectedItemIndex];
            });

            ItemTextFont = Font.SystemFontOfSize(24, FontAttributes.Bold);
        }
    }

Additional Details: Compile using Android version: (Target Version): Use Latest Platform (Android 8.0 (Oreo)) Minimum Android version: Android 7.0 (API Level 24) Target Android version: Use Compile using SDK Version Linking: None Profile: 7

Mythikos commented 6 years ago

After a meeting with the developer, turned out to be an issue with the view model I was using. Changing public List<string> ItemsSource { get; } = new List<string>(); to public List<object> ItemsSource { get; } = new List<object>(); made it so the wheel picker would actually appear in the app.

softlion commented 6 years ago

Sorry for the breaking change. It is documented though, and was required.