Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 79144 articles
Browse latest View live

CollectionView included additional space at the bottom

$
0
0

Hi Team,

I am using the CollectionView with Xamarin.Forms (4.1.0.483098-pre1) package. Facing an issue "Extra spacing was added at the bottom of the colletionview when the row-height is set to 'Auto' in its parent grid".

Below is the code I use

    <ContentPage.Content>
        <ScrollView BackgroundColor="Brown">
            <Grid BackgroundColor="Red" RowSpacing="0" Padding="0" ColumnSpacing="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>

                <CollectionView ItemsSource="{Binding Categories}" Grid.Row="0" BackgroundColor="MistyRose">
                    <CollectionView.ItemsLayout>
                        <GridItemsLayout Span="2" Orientation="Vertical"></GridItemsLayout>
                    </CollectionView.ItemsLayout>
                    <CollectionView.ItemTemplate>
                        <DataTemplate>  
                            <StackLayout Orientation="Vertical" BackgroundColor="Yellow" Padding="12">
                                <Image Source="{Binding ImagePath}" Aspect="Fill" WidthRequest="160" HeightRequest="150"></Image>
                                <Label Text="{Binding ImageName}" FontSize="14" FontAttributes="None" TextColor="Black"></Label>
                            </StackLayout>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>

                <Label Text="Home" TextColor="Blue" Grid.Row="1" VerticalOptions="Start" VerticalTextAlignment="Start" BackgroundColor="Green"></Label>

            </Grid>
        </ScrollView>
    </ContentPage.Content>

The grid clearly has 2 rows and there is a space added between the rows without specifying any properties for that spacing. I haven't checked in UWP and iOS. I cannot post the screenshots because of the restriction "You have to be around for a little while longer before you can post links."


AWS S3 Object Permissions when saved a file using PutObject() in an Xamarin.Forms app

$
0
0

When I save to a file using PutObject(), the file becomes private. So subsequent reads are denied access. How do I make it public?

My code is:

                    PutObjectRequest request = new PutObjectRequest
                    {
                        BucketName = EntBucketName.Text.Trim(),
                        Key = FileName.Text.Trim(),
                        ContentBody = FileContents.Text.Trim(),
                        //CannedACL = S3CannedACL.PublicReadWrite,
                    };

                    PutObjectResponse response = await App.awsS3Client.PutObjectAsync(request);

When I set CannedACL property, the PutObject fails with 'Access Denied' exception. When that is not included the file is overwritten but becomes private so subsequent GetObject fails.

Deleting the file and then saving to it also didn't help.

iOS Binding Unity as a library

$
0
0

Hi all,

I don't even know where to start :D

Since alpha 2019.3 Unity offers the feature "Unity as a Library" https://blogs.unity3d.com/2019/06/17/add-features-powered-by-unity-to-native-mobile-apps/ which I'm currently trying to integrate into one of our Xamarin Apps.
There are descriptions how to do that natively for Android and iOS which I got both working fine.
Just for reference:
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-ios-app.685219/
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app.685240/
This is actually a really big deal so it is great working on it :D

However, I got it working fine for Xamarin Android. Now I'm trying on iOS which appears to be much more complicated.

The unity project will be exported as a native Objective-C++ framework (I think at least as there are .mm files using Objective C)
When using Sharpie to bind the framework I get a super large APIDefinitions file.
After some research I figured out that I have to define a scope to the Headers of the Framework, then the APIDefinitions are in fact much smaller and only reference the header files.

Now to my (current) problem:

If I open the ApiDefinitions then there is an interface UnityFramewok which comes from the UnityFramework.h file.
But this header holds a reference to a class UnityView which is not part of the headers. It is within the framework( at least it is within the Library project in Xcode so I assume it is bundled into the framework.)
I copied the .framework into the bindings Native References but I can't see any actual change happening when I do that.
The UnityView can not be found within the interface and I also can't import it from the library because the native reference is not available.

So how can I reference to a class of the framework from within an interface that is defined in the ApiDefinitions?

Thank you already!

Refresh XAML at runtime Localization

$
0
0

Hey everyone,

I try to implement https://forums.xamarin.com/discussion/82458/binding-indexername-and-binding-providevalue-in-xamarin-forms and I got it. Its working with one label.
My issue is with labels from the listview in my MasterDetail page , the labels doesn't change, if someone see what kind of issue, really thanks you.

My View

<ListView Grid.Row="1" x:Name="MenuListPage" SeparatorVisibility="None" 
              HasUnevenRows="true" ItemsSource="{Binding MenuItems}" >
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
                                <Label VerticalOptions="FillAndExpand" 
                                VerticalTextAlignment="Center" 
                                Text="{Binding Title}" 
                                FontSize="24"/>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

When I Change language

 public static void LoadNewLanguageApp(object language)
        {
            var culture = GetCultureInfoFromString(language);

            // Update UI
            DependencyService.Get<ILanguage>().SetLocale(culture);
            Translator.TranslatorInstance.Invalidate();
        }

My Translator class

/// <summary>
    /// Class using singleton design pattern to translate text
    /// </summary>
    public class Translator : INotifyPropertyChanged
    {
        // Path of folder where is store each file language + Name of file without .en ( language code ) 
        private const string ResourceId = "Landauer.Mobile.Ressources.Language.LanguageRessource";

        /// <summary>
        /// Current culture info
        /// </summary>
        private static CultureInfo CultureInfoApp { get; set; }
        /// <summary>
        /// Unique instance of translator
        /// </summary>
        private static readonly Translator _uniqueInstance = new Translator();

        /// <summary>
        /// Public instance of Translator
        /// </summary>
        public static Translator TranslatorInstance => _uniqueInstance;

        // Instanciation differed of Ressourcemanager
        public static readonly Lazy<ResourceManager> RessourceManagerLanguage = new Lazy<ResourceManager>(() => new ResourceManager(ResourceId, IntrospectionExtensions.GetTypeInfo(typeof(TranslateExtension)).Assembly));

        /// <summary>
        /// When TranslateExtension you create new Binding(), call this "Callback"
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public string this[string text]
        {
            get
            {
                return RessourceManagerLanguage.Value.GetString(text, CultureInfoApp);
            }
        }
        private void InitCulture()
        {
            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
            {
                // Get dependency in each specific platform
                CultureInfoApp = DependencyService.Get<ILanguage>().GetCurrentCultureInfo();
            }
        }
        /// <summary>
        /// Implementation of notifications
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// At each time you set language use this method to refresh UI
        /// </summary>
        public void Invalidate()
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
        }
    }

My TranslateExtension

 // Exclude suffix 'Extension', like that in XAML  use Translate
    [ContentProperty("Text")]
    public class TranslateExtension : IMarkupExtension<BindingBase>
    {
        /// <summary>
        /// Match to the name of the label into .resx file
        /// </summary>
        public string Text { get; set; }

        public TranslateExtension()
        {
        }

        public BindingBase ProvideValue(IServiceProvider serviceProvider)
        {
            var binding = new Binding
            {
                Mode = BindingMode.OneWay,
                Path = $"[{Text}]",
                Source = Translator.TranslatorInstance,
            };
            return binding;
        }

        object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
        {
            return ProvideValue(serviceProvider);
        }

    }

When I Bind Label of my listview

/// <summary>
        /// List of items available into the main menu
        /// </summary>
        public ObservableCollection<MainMenuViewItem> MenuItems
        {
            get
            {
                return this._menuItems;
            }
            set
            {
                this._menuItems = value; RaisePropertyChanged(() => MenuItems);
            }
        }

        private ObservableCollection<MainMenuViewItem> SetDatas()
        {
            return new ObservableCollection<MainMenuViewItem>
            {
                new MainMenuViewItem {Title = Translator.TranslatorInstance["lblHome"], TargetType=typeof(HybridWebView),ViewModelType=HybridViewTypeEnum.Home },
                new MainMenuViewItem {Title = Translator.TranslatorInstance["lblListOfDeliverySlip"], TargetType=typeof(HybridWebView),ViewModelType=HybridViewTypeEnum.ListDeliverySlip },
                new MainMenuViewItem { Title = Translator.TranslatorInstance["lblSettings"], TargetType=typeof(ParametersView)}
            };
        }
    }

    /// <summary>
    /// Model of items for MainMenuMasterView
    /// </summary>
    public class MainMenuViewItem : INotifyPropertyChanged
    {
        private string _title;
        private HybridViewTypeEnum _viewModelType;
        private Type _targetType;

        public MainMenuViewItem() { }

        public string Title
        {
            get { return this._title; }
            set { this._title=value; OnPropertyChanged(); }
        }

        public HybridViewTypeEnum ViewModelType
        {
            get { return this._viewModelType; }
            set { this._viewModelType = value; OnPropertyChanged(); }
        }
        public Type TargetType
        {
            get { return this._targetType; }
            set { this._targetType =value; OnPropertyChanged(); }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

How do I bind Images using MMVM?

$
0
0

I'm using MMVM to bind elements and be able to communicate them throughout different pages.
For strings I'm using the following View Model Structure:

string name = string.Empty;
public string Name
{
get => name;
set
{
if (name == value)
return;
else
{
name = value;
OnPropertyChanged(nameof(Name));
OnPropertyChanged(nameof(DisplayName));

            }
        }
    }
    public string DisplayName => $"Name of Patient: {Name}";
    public event PropertyChangedEventHandler PropertyChanged;
    void OnPropertyChanged(string name)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
    }

Then on the XAML side:
Page 1:

    <Entry Text="{Binding Name}" Placeholder="NAME" />

Page 2:

    <Label Text="{Binding DisplayName}"/>

My Image is acquired using a camera button:
.cs Page Photos

 public PagePhotos()
    {
        InitializeComponent();

        CameraButton.Clicked += CameraButton_Clicked;
    }

    private async void CameraButton_Clicked(object sender, EventArgs e)
    {
        var photo = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions() { });

        if (photo != null)
            PhotoImage.Source = ImageSource.FromStream(() => { return photo.GetStream(); });
    }

XAML Page Photos:

<Image  x:Name="PhotoImage"   HorizontalOptions="Center" VerticalOptions="Center" />
<Button x:Name="CameraButton" Text="Take Photo"  Clicked="CameraButton_Clicked" />

I tried following the same logic using Image instead of string in the View Model:

private Image photo;
public Image Photo
    {
        get
        {
            return photo;
        }
        set
        {
            photo = value;
            OnPropertyChanged2(Photo);
        }
    }
    public event PropertyChangedEventHandler PropertyChanged2;
    void OnPropertyChanged2(Image photo)
    {
        PropertyChanged2?.Invoke(this, PropertyChangedEventArgs(photo));
    }

    publicPropertyChangedEventArgs PropertyChangedEventArgs(Image imageOpenClose)
    {
        throw new NotImplementedException();
    }
}

Then I try on the XAML side to set both images to the same source:
Page 1:

 <Image  x:Name="PhotoImage"   HorizontalOptions="Center" VerticalOptions="Center" Source="{Binding ImageOpenClose}"/>

Page 2:

<Image    Source="{Binding ImageOpenClose}"  VerticalOptions="CenterAndExpand"  HorizontalOptions="CenterAndExpand" />

So I know that I'm setting the ImageSource twice and that PropertyChangedEventArgs usually takes a string as a parameter.
How can I fix this? Or is there another way around it?

Thanks in advance :smile:

Slow performance inside ListView with images

$
0
0

I have a problem, I am using inside my listview images from Url, every time I scroll a list it is laging soo much. I am using default images from xamarin forms:

 <RelativeLayout>
                        <Frame
                            Margin="{Binding PictureMargin}"
                            Padding="0"
                            CornerRadius="{Binding CornerRadius}"
                            HasShadow="False"
                            HeightRequest="{Binding Size}"
                            IsClippedToBounds="True"
                            IsVisible="{Binding IsProfilePicture}"
                            WidthRequest="{Binding Size}">
                            <Image Aspect="AspectFill" Source="{Binding ProfilePicture}" />
                        </Frame>
                        <Frame
                            Margin="{Binding PictureMargin}"
                            Padding="0"
                            BackgroundColor="#4074DD"
                            CornerRadius="{Binding CornerRadius}"
                            HeightRequest="{Binding Size}"
                            HorizontalOptions="Center"
                            IsVisible="{Binding IsInitials}"
                            VerticalOptions="FillAndExpand"
                            WidthRequest="{Binding Size}">
                            <Label
                                FontSize="{Binding TextSize}"
                                HorizontalOptions="Center"
                                Text="{Binding Initials}"
                                TextColor="White"
                                VerticalOptions="Center" />
                        </Frame>
                        <Frame
                            Margin="{Binding CompanyPictureMargin}"
                            Padding="0"
                            BackgroundColor="Transparent"
                            CornerRadius="{Binding CompanyCornerRadius}"
                            HasShadow="False"
                            HeightRequest="{Binding CompanyPictureSize}"
                            HorizontalOptions="Center"
                            IsClippedToBounds="True"
                            IsVisible="{Binding IsCompanyPicture}"
                            WidthRequest="{Binding CompanyPictureSize}">
                            <Image Source="{Binding CompanyPicture}" />
                        </Frame>
                        <Frame
                            Margin="{Binding PictureMargin}"
                            Padding="0"
                            BackgroundColor="#aaaaaa"
                            CornerRadius="{Binding CornerRadius}"
                            HeightRequest="{Binding Size}"
                            HorizontalOptions="Center"
                            IsVisible="{Binding IsExtraCounter}"
                            VerticalOptions="FillAndExpand"
                            WidthRequest="{Binding Size}">
                            <Label
                                FontSize="{Binding TextSize}"
                                HorizontalOptions="Center"
                                Text="{Binding ExtraCountText}"
                                TextColor="White"
                                VerticalOptions="Center" />
                        </Frame>
                    </RelativeLayout>

I am using this view inside my listView

<ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Frame
                                Margin="20,10"
                                Padding="2"
                                BackgroundColor="White"
                                CornerRadius="12"
                                HasShadow="False"
                                HeightRequest="130">
                                <Grid
                                    Margin="10"
                                    ColumnSpacing="0"
                                    RowSpacing="8">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Frame
                                        Grid.Row="0"
                                        Grid.Column="0"
                                        Margin="0,0,10,0"
                                        Padding="0"
                                        BackgroundColor="{Binding StatusOfMeetingColor}"
                                        CornerRadius="5"
                                        HasShadow="False"
                                        HeightRequest="10"
                                        VerticalOptions="Center"
                                        WidthRequest="10" />
                                    <Label
                                        Grid.Row="0"
                                        Grid.Column="1"
                                        Grid.ColumnSpan="2"
                                        Margin="0"
                                        FontAttributes="Bold"
                                        FontSize="18"
                                        LineBreakMode="TailTruncation"
                                        Text="{Binding CreatorDisplayName}"
                                        TextColor="Black"
                                        VerticalOptions="Center" />
                                    <customViews:UsersPictures
                                        Grid.Row="0"
                                        Grid.Column="3"
                                        Margin="0"
                                        Padding="0"
                                        UserList="{Binding UserPicturesItems}" />

I know that the images make this problem, because when I comment them performance of the list is much better. What is more this images flicker. Anyone have this problem ?

connect with api

$
0
0

hi
i am trying to build my first Xamarin form app. it need to connect to api. my api web services work fine in postman. but when i connect in app, response.IsSuccessStatusCode return ok 200 but without data. it return empty list.
this is my code
HttpClient client = new HttpClient();
List StoresList = new List();
var response = await client.GetAsync("my url");
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
StoresList = JsonConvert.DeserializeObject<List>(content);
}
listview.ItemsSource = StoresList;
any help as fast as passible
thanks

What is replacing AppThemeColor?


OrientationSensor.Start and FeatureNotSupportedException

$
0
0

Hi,
I am pretty new to Xamarin so this could be something basic, I've looked online and kind find no reference to this issue, so I am guessing it's me somewhere!

I am calling OrientationSensor as follows, and no matter how I attempt this I am getting a FeatureNotSupportedException exception. I have essentials installed and available to the project. So any idea what the problem could be?

try
{
if (OrientationSensor.IsMonitoring)
OrientationSensor.Stop();
else
OrientationSensor.Start(SensorSpeed.Fastest);
}
catch (FeatureNotSupportedException ex)
{
// Feature not supported on device
}
catch (Exception ex)
{
// Other error has occurred.
}

How to pass initialization argument to view in MVVM

$
0
0

I have a view with two of viewmodels, one of the viewmodels takes a constructor argument. The correct MVVM method is to do as much as possible in the xaml form so have a ResourceDictionary, which accepts the required argument when the view model is instantiated. It works fine if I set a static value manually, for testing, but the argument needs to be passed dynamically and I can find no documentation that explains how to do this.

Here is my xaml for the viewmodels and the argument:

<ContentPage.Resources>
    <ResourceDictionary>
        <local:JobViewModel x:Key="jobViewModel" >
            <x:Arguments>
                <x:String x:Key="arg"></x:String>
            </x:Arguments>
        </local:JobViewModel> 
        <local:StatusViewModel x:Key="statusViewModel" />
    </ResourceDictionary>
</ContentPage.Resources>

The main view passes the argument to the new view:

    public JobPage(string jobId)
    {
        InitializeComponent();
}

but I can't even see a way to pass the argument. i.e. Resources["arg"] = jobId before InitializeComponent can not work and it is to late to pass it after InitializeComponent. How is an argument passed to the view to use during initialization, where the viewmodel can take it as a contructor argument?

How to implement backgrounding & local notifications in Xamarin.Forms iOS application ?

$
0
0

I am creating Xamarin.forms application. I want my application to hit a REST API after every 1 minute, get json data from there and show notification if new data is received. I want this to work on iOS platform.
Can anyone please guide me ?
I am new to iOS.

The video / music should be rotated as rotated phone

$
0
0

How to Detect the phone is rotate in run time(like TextChanged Event). When the phone orientation change Portrait to Landscape is Any Function can Use.

Forms Shell

$
0
0

Watched James's Island Tracker presentation and decided to poke at Forms Shell try and figure it out and I am running into difficulty.

In my AppShell.xaml I have

In my AppShell.xaml.cs I have
public ICommand AboutCommand => new Command( ()=> Debug.Write("worked"));
(it was public ICommand AboutCommand => new Command(async () => await GotoAbout());, but I tried to simplify to get it to work.)

When I click about, I can find no evidence that it has worked.

Is there something I am likely failing to connect up?

Implement Android background task with dependency service

$
0
0

Hello all, I am implementing the Android version of the following iOS code. I am wondering how I can implement the same functionality in Android? Do I need to create a job scheduler/service in another class first before implementing code here?

Thanks!

            var task = UIApplication.SharedApplication.BeginBackgroundTask(() => { });
            Task.Run(async () => {
                await // do something;
                UIApplication.SharedApplication.EndBackgroundTask(task);
            });

Fingerprint on Xamarin Forms

$
0
0

Hi,

For the application security, I have a pin protection on my app. And now I try to add fingerprit if phone has fingerprint feature.
If users want to set both of them (pin and fingerprint), I want to open one page and users can use both pin and fingerprint to unlock the page.

So I looked for a nuget which is Plugin.Fingerprint.CrossFingerprint. It works well but I have to use it with dialog. But I don't want to open fingerprint dialog. Because if dialog is opened, I can't use pin feature.

After I looked, Plugin.Fingerprint.CrossFingerprint has UseDialog=true/false feature in 1.4.9 version. But when I set this feature, I can't catch "not recognized fingerprint" status. I can catch only Authenticated or FingerprintAuthenticationResultStatus (Canceled, TooManyAttempts etc..)

I need to use both pin and fingerprint feature in my app. How can I use Plugin.Fingerprint.CrossFingerprint without dialog on my pin page with pin option? Or must I use custom renderer for fingerprint? Or is there any other nugets?

Thank you in advance.


Shell hide back button

$
0
0

HI, How to completely hide a back button in Xamarin.Forms shell?
BackButtonBehavior IsEnabled="False" -does nothing on IOS
IconOverride="" -hides it but someplace in the toolbar it is still reserved for it. and it looks like a workaround not a solution.

AppShell Searchhandler Questions

$
0
0

I need to submit search paramaters to REST service.

  • Question 1: Is it appropriate to call a REST service from the SearchHandler class?
  • Question 2: Is it possible to display an ActivityIndictor while waiting for results of the REST call?
  • Question 3: I have tried, without success, to only display the search results upon confirmation -- via "OnQueryConfirmed" -- but the behavior is not what I expected. The results don't display on initial confirmation, BUT on subsequent expansion of the SearchHandler and after pressing another key they do show -- but not filtered based on the current text enterred.
  • Question 4: Other than the MS documentation I have not found any examples of implementations of SearchHandler on the web, including StackOverflow. Is Searchhandler ready for prime time?

Thanks in advance.
-- Dean

Scrolling multiple lists at the same time.

$
0
0

That is roughly the problem I have.
Here is the code:

<CollectionView x:Name="colview" VerticalScrollBarVisibility="Never" HorizontalScrollBarVisibility="Never" RemainingItemsThreshold="5">
                <CollectionView.ItemsLayout>
                    <GridItemsLayout Orientation="Horizontal"/>
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="160"/> <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120"/>
                            </Grid.ColumnDefinitions>
                            <Label Text="{Binding name}" BackgroundColor="{Binding backcol}" FontSize="20" FontAttributes="Bold" WidthRequest="100" Margin="0,0,0,2"
                                   HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
                                   HorizontalTextAlignment="Center" VerticalTextAlignment="Center"
                                   Grid.Column="0" Grid.Row="0"/>
                            <ListView ItemsSource="{Binding listtimes}" HasUnevenRows="False" SelectionMode="None" SeparatorVisibility="None" 
                                      VerticalScrollBarVisibility="Never" HorizontalScrollBarVisibility="Never"
                                      CachingStrategy="RecycleElementAndDataTemplate" Scrolled="ListView_Scrolled"
                                      Grid.Column="0" Grid.Row="1" >
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <Label Text="{Binding time, StringFormat='{}{0:H\\:mm}'}" BackgroundColor="{Binding backgr}" FontSize="15" WidthRequest="100"
                                                   HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
                                                   HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>
                        </Grid>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

Yep, t's a CollectionView loaded by bindings. To make it short, we give it a collection of objects (let's call them "points", if you will) with 3 properties: "name" (string) "listtimes" (list) and "backcol" (another string). We then bind the property "name" to a label and "listtimes" to a ListView (this is where things get confusing). "listtimes" is another list of objects (call 'em "times") with their own variables: "time" (DateTime) and "backgr" (string). Both "backcol" and "backgr" are Hex codes for the background color of each label.

In the CS part of the code we do this:

List<point> points = new List<point>([all data goes here]);
colview.ItemsSource = points;

and the rest is binding...

As you can see, the ListViews have a "Scrolled" property, but we are unable to access the other lists in order to, when one is scrolled, scroll the rest equally. I know this sound ridiculous but, hey, I can't contradict my higher-ups! That's what they want and that's what I'm asking.

Thank you very much and apologies for this mess.

Best regards.

P.S.: Some of the ListViews may not have the same amount of lines. In fact a handful of them might have so few items that cannot scroll. Sooo yeah...

Adjusting controls for different resolutions

$
0
0

If the resolution is different, not all controls may be displayed.
Is there a way to adjust the controls automatically?

How to use onplatform in ResourceDictionary

$
0
0

Hi all i want to add OnPlatform for a setter of style but i want it on code behind not xaml

var Setters = new Setter { Property = Label.FontFamilyProperty, Value = MyProperty };

myStyle.Setters.Add(Setters);

Thanks.

Viewing all 79144 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>