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

make a custom keyboard

$
0
0

Hello.
is possible to do a keyboard to cross platforms as like the photo ?
I asking for complete DNI.!


binding data of multiple classes to a single list view

$
0
0

Hi i'm having trouble in binding data of multiple classes to a single list view.

How to deselect clicked one in master details slide menu in xamarin forms after processed?

$
0
0

How to deselect clicked one in master details slide menu in xamarin forms after processed?

Form Crashes after log in

$
0
0

Hi why my app crashes after log in and doesnt go to my masterdetailpage

How to check a page is in the navigation stack or not?

$
0
0

How to check a content page already have on navigation stack or not in xamarin forms?

Create an image in code

$
0
0

I would like to know how to create an image in code.

For example A blue field X by X pixels with a red line and some text. I have a goal of adding a splash to an actual image similar to how the sports channels have a stripe and some words. Right now I am focusing on the basics of adding elements to a new blank image.

This type of image with transparencies overlay is a related goal.

The very basics of this can be done trivially in regular .net like this:
...
Bitmap flag = new Bitmap(200, 100);
Graphics flagGraphics = Graphics.FromImage(flag);
int red = 0;
int white = 11;
while (white <= 100) {
flagGraphics.FillRectangle(Brushes.Red, 0, red, 200,10);
flagGraphics.FillRectangle(Brushes.White, 0, white, 200, 10);
red += 20;
white += 20;
}
...

I have spent a lot of time on other things that have had a simple answer if I had asked first. Hoping this is like that.

My thanks in advance

Display alert when internet connection is not provided

$
0
0

Hello, Can anyone help me for displaying alert when internet connection of device is disabled, as application needs internet connection to perform its tasks. How can I check whether internet connection of particular device is on or off and if internet connection is off then whenever app starts it should show such kind of error to inform user for enabling internet connection.

ZXing Crashes At LoadApplication

$
0
0

I'm having a problem where the ZXing.Net.Mobile.Forms is causing my app to crash at LoadApplication(new App()); At first I was trying to integrate the package into an existing solution. So, I tried creating a new one with the same results.

If I remove ZXing.Net.Mobile.Forms and just have ZXing.Net.Mobile installed, the app works just fine.

As always, thanks for any help.


SfListView not detecting swipe image when using prism?

$
0
0

Trying to handle clicking on a image in the leftswipe area. Using prism as below..but tapping on a image does nothing and produces no error.

Any suggestion?

............................
<sync:SfListView.LeftSwipeTemplate> //syncfusion


<Grid.ColumnDefinitions>



</Grid.ColumnDefinitions>



<Image.GestureRecognizers> //NOT WORKING

</Image.GestureRecognizers>






                        </Grid>
                        <Grid
                            Grid.Column="2"
                            BackgroundColor="#009EDA"
                            HorizontalOptions="Fill"
                            VerticalOptions="Fill">
                            <Grid HorizontalOptions="Center" VerticalOptions="Center">
                                <Image
                                    Grid.Row="0"
                                    Grid.Column="0"
                                    BackgroundColor="Transparent"
                                    HeightRequest="35"
                                    Source="site.png"
                                    WidthRequest="35" />
                            </Grid>

                        </Grid>
                    </Grid>
                </DataTemplate>
            </sync:SfListView.LeftSwipeTemplate>

.................................

//VIEW MODEL
public DelegateCommand SelectFavCommand { get; set; }
public ClientsViewModel(INavigationService navigationService, IPageDialogService ipageserve, IEventAggregator ea)
{
_navigationService = navigationService;
SelectFavCommand = new DelegateCommand(SelectFavCommandHandler);
}

    private void SelectFavCommandHandler(object sender)
    {
           //NEVER REACHES HERE
    }

System.IO.FileNotFoundException Could not load assembly System.Drawing

$
0
0

Hello,

I meet this error in a Xamarin.forms project using WebView and local html base url:

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
Nom de fichier : 'System.Drawing.dll'
à Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
à Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
à Xamarin.Android.Tasks.ResolveAssemblies.Execute() Almicantarat.Droid

I read that: System.IO.FileNotFoundException: Could not load assembly System.Web in Mono for Android

but I don't know which client's source code I should compile.

I read that: Could not load file or assembly 'System.Drawing, Version=4.0.0.0
but in my project, reference to System.Drawing is coming from mono.android which is a Xamarin component!

Should I compile mono.android myself ? where could I find it ? does Xamarin provide it ?

See my references attached.

Thanks

How to use 'speechrecognition' plugin?

$
0
0

Hi
I'm want to use 'speechrecognition" (https://github.com/aritchie/speechrecognition)
I know how to install it by asking the developer directly, but I can not use it.
How do I use 'Continuous Dictation'?
I just want to put the speech into the editor by just pressing the button.

Issue with Forms 2.4.0.280 on an android [No view found for id 0x1 (unknown) for fragment]

$
0
0

Hello,

After an update of xamarin.forms nuget to 2.4.0.280, I have an issue with an android

Here's stack trace:

09-29 06:50:25.610 E/mono (17500): Unhandled Exception:
09-29 06:50:25.610 E/mono (17500): Java.Lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment FragmentContainer{1716c46c #0 id=0x1}
referenceTable GDEF length=670 1
referenceTable GSUB length=7202 1
referenceTable GPOS length=24560 1
09-29 06:50:25.610 E/mono (17500): --- End of managed Java.Lang.IllegalArgumentException stack trace ---
09-29 06:50:25.610 E/mono (17500): java.lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment FragmentContainer{1716c46c #0 id=0x1}
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1334)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1569)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:379)
09-29 06:50:25.610 E/mono (17500): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607)
09-29 06:50:25.610 E/mono (17500): at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
09-29 06:50:25.610 E/mono (17500): at md5a32ee3795e82798420962242b26c9524.MvxFormsAppCompatActivity.n_onStart(Native Method)
09-29 06:50:25.610 E/mono (17500): at md5a32ee3795e82798420962242b26c9524.MvxFormsAppCompatActivity.onStart(MvxFormsAppCompatActivity.java:43)
09-29 06:50:25.610 E/mono (17500): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
09-29 06:50:25.610 E/mono (17500): at android.app.Activity.performStart(Activity.java:5953)
09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.access$800(ActivityThread.java:144)
09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
09-29 06:50:25.610 E/mono (17500): at android.os.Handler.dispatchMessage(Handler.java:102)
09-29 06:50:25.610 E/mono (17500): at android.os.Looper.loop(Looper.java:135)
09-29 06:50:25.610 E/mono (17500): at android.app.ActivityThread.main(ActivityThread.java:5221)
09-29 06:50:25.610 E/mono (17500): at java.lang.reflect.Method.invoke(Native Method)
09-29 06:50:25.610 E/mono (17500): at java.lang.reflect.Method.invoke(Method.java:372)
09-29 06:50:25.610 E/mono (17500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
09-29 06:50:25.610 E/mono (17500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
09-29 06:50:25.610 E/mono (17500):

There is an example of the issue
https://github.com/JTOne123/XamFormsMvxTemplate/blob/master/MvxForms.sln

PS: If switch back to 2.3.4, everything will be ok

Android OpenGLView displays on simulators but not on physical devices

$
0
0

Hi all, I have a bit of code here that runs very well on iOS, and in the Android simulator (all is displayed properly). However, I have tried to run it on two different devices (Nexus 5, and SM-P900) both of which will not display the OpenGL render, rather just a black box.

Here is my OpenTK code that is put into the OnDisplay method

using System;
using OpenTK.Graphics.ES20;
using OpenTK.Graphics;
using OpenTK;
using Xamarin.Forms;
using CubeCrack.Shared;
using System.Reflection;
using System.IO;
using System.Collections.Generic;
using System.Diagnostics;
#if __ANDROID__
using Android.Util;
#endif

[assembly: Dependency(typeof(GLEngineShared))]
namespace CubeCrack.Shared
{
    public class GLEngineShared : GLEngine
    {
        uint frameBuffer;
        uint indexBuffer;
        
        uint colorRenderBuffer;
        uint depthRenderBuffer;
        int positionSlot;
        int colorSlot;
        int projectionSlot;
        int modelViewSlot;
        int cubieViewSlot;

        int width_pixels, height_pixels;

        float rotate = 0.0f;
        static readonly float offset = 2.05f;

        public OpenGLView View { get; set; }
        public CubeViewModel ViewModel { get; set; }
        Matrix4 animationMatrix;

        public GLEngineShared () { }

        void SetupRenderBuffers(){
            #if __ANDROID__
            width_pixels = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, (float) View.Width, Xamarin.Forms.Forms.Context.Resources.DisplayMetrics);
            height_pixels = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, (float) View.Height, Xamarin.Forms.Forms.Context.Resources.DisplayMetrics);
            Debug.WriteLine("width: " + width_pixels + " height: " + height_pixels);
            #else
            width_pixels = (int)View.Width;
            height_pixels = (int)View.Height;
            #endif
            GL.GenRenderbuffers (1, out depthRenderBuffer);
            GL.BindRenderbuffer (RenderbufferTarget.Renderbuffer, depthRenderBuffer);
            GL.RenderbufferStorage (RenderbufferTarget.Renderbuffer, RenderbufferInternalFormat.DepthComponent16,
                width_pixels, height_pixels);
            
            GL.GenRenderbuffers (1, out colorRenderBuffer);
            GL.BindRenderbuffer (RenderbufferTarget.Renderbuffer, colorRenderBuffer);
            GL.RenderbufferStorage (RenderbufferTarget.Renderbuffer, RenderbufferInternalFormat.Rgba4,
                width_pixels, height_pixels);
        }

        void SetupFrameBuffer(){
            GL.GenFramebuffers (1, out frameBuffer);
            GL.BindFramebuffer (FramebufferTarget.Framebuffer, frameBuffer);
            GL.FramebufferRenderbuffer (FramebufferTarget.Framebuffer, FramebufferSlot.ColorAttachment0,
                RenderbufferTarget.Renderbuffer, colorRenderBuffer);
            GL.FramebufferRenderbuffer (FramebufferTarget.Framebuffer, FramebufferSlot.DepthAttachment,
                RenderbufferTarget.Renderbuffer, depthRenderBuffer);
        }

        int CompileShader(string shaderName, ShaderType shaderType){
            string prefix;
            #if __IOS__
            prefix = "CubeCrack.iOS.";
            #elif __ANDROID__
            prefix = "CubeCrack.Droid.";
            #endif
            var assembly = typeof(GLEngineShared).GetTypeInfo ().Assembly;
            Stream stream = assembly.GetManifestResourceStream (prefix + "Shaders." + shaderName + ".glsl");
            string shaderString;
            using (var reader = new StreamReader (stream)) {
                shaderString = reader.ReadToEnd ();
            }
            int shaderHandle = GL.CreateShader (shaderType);
            GL.ShaderSource (shaderHandle, shaderString);
            GL.CompileShader (shaderHandle);
            return shaderHandle;
        }

        void CompileShaders(){
            int vertexShader = CompileShader ("SimpleVertex", ShaderType.VertexShader);
            int fragmentShader = CompileShader ("SimpleFragment", ShaderType.FragmentShader);
            int programHandle = GL.CreateProgram ();
            GL.AttachShader (programHandle, vertexShader);
            GL.AttachShader (programHandle, fragmentShader);
            GL.LinkProgram (programHandle);
            GL.UseProgram (programHandle);

            positionSlot = GL.GetAttribLocation (programHandle, "Position");
            colorSlot = GL.GetAttribLocation (programHandle, "SourceColor");
            projectionSlot = GL.GetUniformLocation (programHandle, "Projection");
            modelViewSlot = GL.GetUniformLocation (programHandle, "Modelview");
            cubieViewSlot = GL.GetUniformLocation (programHandle, "CubieView");

            GL.EnableVertexAttribArray (positionSlot);
            GL.EnableVertexAttribArray (colorSlot);
        }

        void SetupVBOs(){
            uint vertexBuffer;
            GL.GenBuffers (1, out vertexBuffer);
            GL.BindBuffer (BufferTarget.ArrayBuffer, vertexBuffer);
            GL.BufferData (BufferTarget.ArrayBuffer, (IntPtr)(Vector3.SizeInBytes * CubeData.Verticies.Length), CubeData.Verticies, BufferUsage.StaticDraw);
            GL.VertexAttribPointer (positionSlot, 3, VertexAttribPointerType.Float, false, Vector3.SizeInBytes, 0);



//          GL.GenBuffers (1, out indexBuffer);
//          GL.BindBuffer (BufferTarget.ElementArrayBuffer, indexBuffer);
//          GL.BufferData (BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(byte) * CubeData.Indices.Length), CubeData.Indices, BufferUsage.StaticDraw);
        }

        #region GLEngine implementation

        public void Initialize ()
        {
//          GL.Viewport (0, 0, (int)View.Width, (int)View.Height);
            SetupRenderBuffers ();
            SetupFrameBuffer ();
            CompileShaders ();
            SetupVBOs ();
        }

        public void DrawCornerCubes(){
            for (int i = 0; i < 8; i++) {
                var colorData = new List ();
                var colors = ViewModel.GetCornerColors (i);
                foreach (var color in colors) {
                    colorData.Add (CubeData.GetVectorFromColor (color));
                }

                var ColorData = new Vector4[24];
                for(int j = 0; j < 24; j++){
                    ColorData[j] = new Vector4(0,0,0,1);
                }
                for(int j = 4; j <= 7; j++){
                    ColorData [j] = colorData [0];
                }
                for(int j = 16; j <= 19; j++){
                    ColorData [j] = colorData [1];
                }
                for (int j = 8; j <= 11; j++) {
                    ColorData [j] = colorData [2];
                }

                uint colorBuffer;
                GL.GenBuffers (1, out colorBuffer);
                GL.BindBuffer (BufferTarget.ArrayBuffer, colorBuffer);
                GL.BufferData (BufferTarget.ArrayBuffer, (IntPtr)(Vector4.SizeInBytes * ColorData.Length), ColorData, BufferUsage.StaticDraw);
                GL.VertexAttribPointer (colorSlot, 4, VertexAttribPointerType.Float, false, Vector4.SizeInBytes, 0);

                Matrix4 animateMatrix;
                if (ViewModel.IsCornerAnimating (i))
                    animateMatrix = animationMatrix;
                else
                    animateMatrix = Matrix4.Identity;
                
                Matrix4 rotationMatrix = Matrix4.CreateRotationX (CubeViewModel.CornerRotationTable [i][0]) *
                                         Matrix4.CreateRotationY (CubeViewModel.CornerRotationTable [i][1]) *
                                         Matrix4.CreateRotationZ (CubeViewModel.CornerRotationTable [i][2]);
                Matrix4 translationMatrix = Matrix4.CreateTranslation (offset * CubeViewModel.CornerTranslationTable [i] [0],
                                                offset * CubeViewModel.CornerTranslationTable [i] [1], offset * CubeViewModel.CornerTranslationTable [i] [2]);
                Matrix4[] cubieView = { rotationMatrix * translationMatrix * animateMatrix };
                GL.UniformMatrix4 (cubieViewSlot, false, ref cubieView [0]);
                GL.DrawElements(BeginMode.Triangles, CubeData.Indices.Length, DrawElementsType.UnsignedByte, CubeData.Indices);
                colorData.Clear ();

                GL.DeleteBuffers (1, ref colorBuffer);
            }
        }

        public void DrawEdgeCubes(){
            for (int i = 0; i < 12; i++) {
                var colorData = new List<Vector4> ();
                var colors = ViewModel.GetEdgeColors (i);
                foreach (var color in colors) {
                    colorData.Add (CubeData.GetVectorFromColor (color));
                }

                var ColorData = new Vector4[24];
                for(int j = 0; j < 24; j++){
                    ColorData[j] = new Vector4(0,0,0,1);
                }
                for(int j = 4; j 

The error I with the Nexus 5 is

[Adreno-EGLSUB] : Invalid native buffer. Failed to queueBuffer
[Adreno-EGLSUB] : native buffer is NULL

And over with my Samsung Note 12.2 (SM-P900)
I noticed this line, which I believe is relevant

[mali_winsys] new_window_surface returns 0x3000

Neither of the applications crash, but just display a black box where I should have OpenGL code rendering.

Any advice on how to debug or find the problem and solution would be much appreciated.

Setting a header of a grid in a listview

$
0
0

Hey, I am trying to add a header to my listview. My listview contents will be a grid, so the column sizes will change dynamically. I have tried using listview.header, but the size of the header column is not related to the grid so does not size appropriately.

I have also tried adding another row in the grid. The first one being the header. But as expected, this duplicates for each row of the listview. Is there an easy way to do this, or to say, this is first row in listview, so only display header on this row?

Here is my code

<ListView ItemsSource="{Binding Orders}" HorizontalOptions="Center">
          <ListView.Header>
              <StackLayout Orientation="Horizontal" BackgroundColor="Black">
                <Label Text="Product" />
                <Label Text="Quantity" />
              </StackLayout>
          </ListView.Header>
          <ListView.ItemTemplate>
            <DataTemplate>
              <ViewCell>
                <Grid Style="{StaticResource GridInListViewStyle}" HorizontalOptions="Center" >
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="75"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>
                  <Label  Text="Product" BackgroundColor="Green" Grid.Column="0" Grid.Row="0" />
                  <Label Text="Quantity" BackgroundColor="Green" Grid.Column="1" Grid.Row="0"/>
                  <StackLayout Orientation="Horizontal" Grid.Column="0" Grid.Row="1" Padding="10, 0, 0, 0">
                    <Label Text="{Binding ProductName}" VerticalOptions="Center" />
                  </StackLayout>
                  <Entry Keyboard="Numeric" Grid.Column="1" Grid.Row="1" VerticalOptions="Center"/>
                </Grid>
              </ViewCell>
            </DataTemplate>
          </ListView.ItemTemplate>
        </ListView>

Attached is current layout

Thanks

How to resolve the error _WebTryThreadLock(bool) in Xamarin forms IOS

$
0
0

Hi,
I am getting the below error in iPhone 10, other phone it is working fine.

I am trying to close the popup page has one webview and button, on button click I am showing an confirmation alert message on click ok I am trying to close the Popup page,
Used Rg.plugins.popup for thr popup page.

bool _WebTryThreadLock(bool), 0x60c0004001e0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...

@BalakrishnanS


WCF communication problem for Android device only

$
0
0

Hi there
My app throws the exception
"SecureChannelFailure. The authentication or decryption is failed".
Strange enough, it is not working for Android only. The iOS device works fine with no errors at all.
What can be that makes it not working for Android?
Thanks.

Weird Pressed shadow in android after updating to XF 2.5

$
0
0

Hello
After upgrading to XF 2.5 I have a weird small shadow on every android button after pressing them.
https: //drive.google.com/open?id =1V3LMp5o1f8hwaPZL3jTA4b8jJToyq-5t
here is a video of what happens after I press a button.

here is the code of the button

                <Button HeightRequest="60"
                        x:Name="CameraButton"
                        Image="camera_cyan.png"
                        Clicked="OnCameraClicked" 
                        FontSize="Medium"
                        CornerRadius="5"
                        TextColor="{StaticResource Primary}"
                        BackgroundColor="{StaticResource PrimaryAlternate}"/>

Tizen on macOS

Getting IndexOutOfRangeException when I try to get the DependencyService for tabbed pages.

$
0
0

This is the code for the TabbedPage.xaml
`using RapidRate.Models;
using RapidRate.Services;
using RapidRate.ViewModels;
using System.Collections.Generic;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace RapidRate
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MyReviewsTabbedPage : TabbedPage
{
public MyReviewsTabbedPage()
{
InitializeComponent();

        BindingContext = new MyReviewsViewModel(
            DependencyService.Get<INavService>()
        );
    }

    MyReviewsViewModel _vm
    {
        get {
            return BindingContext as MyReviewsViewModel;
        }
    }

    protected override async void OnAppearing()
    {
        base.OnAppearing();
        if (_vm != null)
            await _vm.Init();
    }
}

}`

INavService.cs
`using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RapidRate.ViewModels;

namespace RapidRate.Services
{
public interface INavService
{
bool CanGoBack { get; }

    Task GoBack();

    Task NavigateTo<TVM>() where TVM : BaseViewModel;

    Task NavigateTo<TVM, TParameter>(TParameter parameter) where TVM : BaseViewModel;

    Task RemoveLastView();

    Task ClearBackStack();

    Task NavigateToUri(Uri uri);

    event PropertyChangedEventHandler CanGoBackChanged;
}

}
`

and here is the view model for the tabbed page:
`using RapidRate.Models;
using RapidRate.Services;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;

namespace RapidRate.ViewModels
{
class MyReviewsViewModel : BaseViewModel
{
public MyReviewsViewModel(INavService navService) : base(navService)
{
AvgScores = new ObservableCollection();
MyReviews = new ObservableCollection();
}

    private ObservableCollection<RapidRateReport> _avgScores;
    public ObservableCollection<RapidRateReport> AvgScores
    {
        get { return _avgScores; }
        set { _avgScores = value; OnPropertyChanged(); }
    }

    private ObservableCollection<PeopleRapidRate> _myReviews;
    public ObservableCollection<PeopleRapidRate> MyReviews
    {
        get { return _myReviews; }
        set { _myReviews = value; OnPropertyChanged(); }
    }

    public override async Task Init()
    {
        await LoadEntries();
    }

    async Task LoadEntries()
    {
        AvgScores.Clear();
        List<RapidRateReport> reviews = WebService.GetRapidRateAvgReport(App.CompanyID, App.PID);
        foreach(RapidRateReport review in reviews)
        {
            AvgScores.Add(review);
        }
    }
}

}`

Is there anything else you need?

How to add items to custom control

$
0
0

I would like to build a custom Frame control with an SKCanvasView as a background.

I already have a "SolidBox" control which works wonderfully.

Currently, I make a Grid, fill it with a SolidBox, then put my content inside.

I would like to do this the way the Frame control does.

Here is what I currently do:

<Grid HorizontalOptions="Center"
      VerticalOptions="Center">

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>

    <controls:SolidBox Grid.Row="0" Grid.Column="0"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="FillAndExpand"
                       LineColor="DarkBlue"
                       LineThickness="4"
                       CornerRadius="5"
                       InnerColor="White"/>

    <Grid Grid.Row="0" Grid.Column="0"
          HorizontalOptions="Center"
          VerticalOptions="Center"
          Margin="5">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Add my content -->
        <Label Grid.Row="0" Text="Line 1"/>
        <Label Grid.Row="1" Text="Line 2"/>
        <Label Grid.Row="2" Text="Line 3"/>

    </Grid>

</Grid>

What I would like to do is create a control to simplify things

<controls:CustomFrame HorizontalOptions="FillAndExpand"
                      VerticalOptions="FillAndExpand"
                      LineColor="DarkBlue"
                      LineThickness="4"
                      CornerRadius="5"
                      InnerColor="White"/>

    <StackLayout Orientation="Vertical">

        <!-- Add my content -->
        <Label Grid.Row="0" Text="Line 1"/>
        <Label Grid.Row="1" Text="Line 2"/>
        <Label Grid.Row="2" Text="Line 3"/>

    </StackLayout>

</controls:CustomFrame>

But I don't know how to handle the children of the control in the xaml.cs ...
When the StackLayout is added in xaml, how do I handle that in my xaml.cs?

Viewing all 91519 articles
Browse latest View live


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