We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Odd behavior

I have a Xamarin.Forms PCL project and have a xaml page (relevant code below)

if I add "viewmode = linear", the entire control doesnt show up. if the control shows up, the buttons do not, if the control doesnt show up, the buttons do. and the "default" viewmode seems to start from the bottom right of the screen and swipe up to the top left of the screen. i will attach a screenshot

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="SkazPro.BrewControl.Pages.RecipesPage"
             xmlns:carousel="clr-namespace:Syncfusion.SfCarousel.XForms;assembly=Syncfusion.SfCarousel.XForms">
  <ContentPage.Resources>
    <ResourceDictionary>
      <DataTemplate x:Key="ItemTemplate">
        <StackLayout Orientation="Vertical">
          <Label Text="{Binding Name}" TextColor="Black" FontSize="Large"  />
          <Label Text="{Binding FG}" TextColor="Black" FontSize="Small"  />
          <Label Text="{Binding OG}" TextColor="Black" FontSize="Small"  />
        </StackLayout>
      </DataTemplate>
    </ResourceDictionary>
  </ContentPage.Resources>
  <StackLayout>
    <carousel:SfCarousel x:Name="Carousel"  ItemTemplate="{StaticResource ItemTemplate}" DataSource="{Binding Recipes}" Offset="20" RotationAngle="30" SelectedIndex="1" HeightRequest="600" />
    <StackLayout Orientation="Horizontal">
      <Button Text="New Recipe" HorizontalOptions="Center" Clicked="OnNewClicked"/>
      <Button Text="Details" HorizontalOptions="Center" Clicked="OnDetailsClicked"/>
      <Button Text="Import" HorizontalOptions="Center" Clicked="OnImportClick"/>
    </StackLayout>
  </StackLayout>
</ContentPage>

the cs file:
  public partial class RecipesPage : ContentPage
    {
        public RecipesPage()
        {
            InitializeComponent();
            Carousel.BindingContext = new RecipesViewModel();
        }

        private void OnDetailsClicked(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        private void OnNewClicked(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        private void OnImportClick(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }
    }

recipeviewmodel.cs
 public class RecipesViewModel : ViewModelBase
    {
        public RecipesViewModel()
        {
#if DEBUG
            Recipes.Add(new Recipe
            {
                Name = "Test 1",
                FG = 1.120,
                OG = 0.120
            });
            Recipes.Add(new Recipe
            {
                Name = "Test 2",
                FG = 1.00,
                OG = 0.20
            });
            Recipes.Add(new Recipe
            {
                Name = "Test 3",
                FG = 0.95,
                OG = 0.09
            });
#endif
        }

        private ObservableCollection<Recipe> _recipes;

        public ObservableCollection<Recipe> Recipes
        {
            get
            {
                if (_recipes == null) Recipes = new ObservableCollection<Recipe>();
                return _recipes;
            }
            set
            {
                if (_recipes == value) return;
                OnPropertyChanging(() => Recipes);
                _recipes = value;
                OnCollectionChanged(() => Recipes);
            }
        }

        public Recipe SelectedRecipe
        {
            get
            {
                if (_selectedRecipe == null) SelectedRecipe = new Recipe();
                return _selectedRecipe;
            }
            set
            {
                if (_selectedRecipe == value) return;
                OnPropertyChanging(() => SelectedRecipe);
                _selectedRecipe = value;
                OnPropertyChanged(() => SelectedRecipe);
            }
        }

        private Recipe _selectedRecipe;

    }
}


Attachment: screenshot_7ec69f6b.zip

3 Replies

RK Rathana Kumar Sekar Syncfusion Team January 30, 2017 12:46 PM UTC

Hi Keven,

Thank you for contacting Syncfusion Support.

We have checked the reported issue in our side. But we were unable to reproduce the reported issue. Please find the sample in which we have checked the reported issue in below

Sample: http://www.syncfusion.com/downloads/support/forum/128548/ze/SfCarouselSample357517424 

So could you please provide more information like issue reproducing sample or else modify above sample to reproduced reported issue.This will help us to provide appropriate solution on this.

Regards,
Rathanakumar S
 



KA KEVEN A SCHARASWAK January 30, 2017 03:28 PM UTC

Here is your project, modified by me. 
Attachment: SfCarouselSample357517424__ad57d0bf.zip


RK Rathana Kumar Sekar Syncfusion Team January 31, 2017 12:09 PM UTC

Hi Keven,

Thank you for contacting Syncfusion Support.

On further analysis with the provided sample we found that the height and width of the item has been not set.We have modified the sample with itemHeight and itemwidth for SfCarousel. Please find the modified sample below.


 
Regards,
Rathanakumar S


Loader.
Live Chat Icon For mobile
Up arrow icon