Telerik Forums
UI for Xamarin Forum
2 answers
308 views

Hello,

I'm able to successfully set up a Xamarin Forms popup from the sample code here.  If I add this to a single Xaml page, I'm able to get the popup to open/close from the code-behind.
However I'm going to be using this in multiple areas of my application and wanted to see if it's possible to run this through a service.  To be specific, I want to use this to act like a busy indicator, to display an animated icon while data is loading, then close when done.  I'm trying to replicate this same type of functionality we're already using with another popup Rg.Plugins.Popup.  The difference with Telerik's version is that I want to see if I can avoid having to put the popup Xaml on every one of my pages.

 

Here's a service we're currently using.

01.public class PopupService : IPopupService
02.{
03.    private LoadingPopup indicatorPopup;   
04.
05.    //Get a new instance of the page that contains the popup Xaml
06.    public LoadingPopup IndicatorPopup { get { return indicatorPopup ?? (indicatorPopup = new LoadingPopup()); } }
07.    
08.    public async Task ShowIndicatorAsync()
09.    {
10.        Device.BeginInvokeOnMainThread(async () =>
11.        {
12.            //Open the popup from that page
13.            await PopupNavigation.Instance.PushAsync(IndicatorPopup, false);
14.        });
15.    }
16. 
17.    public async Task DismissIndicatorAsync()
18.    {
19.        Device.BeginInvokeOnMainThread(async () =>
20.        {
21.            //Close the popup from that page
22.            await PopupNavigation.Instance.RemovePageAsync(IndicatorPopup, false);
23.        });
24.    }
25.}

 

The popups are called in the ViewModels by using the service like this.

01.public class SamplePageViewModel : BaseViewModel
02.{
03.    private readonly IFinancialDataService _financialDataService;
04. 
05.    public SamplePageViewModel (IFinancialDataService financialDataService, IPopupService popupService) : base(popupService)
06.    {
07.        _financialDataService = financialDataService;
08.    }
09. 
10.    public async Task Init()
11.    {
12.        try
13.        {
14.            //Show popup here
15.            await PopupService.ShowIndicatorAsync();
 16
17.            var data = await _financialDataService.GetData();          
18.            ...
19.        }
20.        catch (Exception e)
21.        {
22.            ...
23.        }
24.        finally
25.        {
26.           //Close popup here
27.           await PopupService.DismissIndicatorAsync();
28.        }
29.    }
30.}

 

 

So what I'm trying to do is put the Telerik popup Xaml in a Content Page and call it through the service instead. 

I can add public methods to the code-behind of that page like this.

01.public void ShowPopup()
02.{
03.    popup.IsOpen = true;
04.}
05. 
06.public void ClosePopup()
07.{
08.    popup.IsOpen = false;
09.}

 

Then I can call those methods from my same service like this instead.

01.public async Task ShowIndicatorAsync()
02.{
03.    Device.BeginInvokeOnMainThread(async () =>
04.    {
05.        //Now call the open method in the code-behind
06.        IndicatorPopup.ShowPopup();
07.    });
08.}
09. 
10.public async Task DismissIndicatorAsync()
11.{
12.    Device.BeginInvokeOnMainThread(async () =>
13.    {
14.        //Now call the close method in the code-behind
15.        IndicatorPopup.ClosePopup();
16.    });
17.}

 

When I do this, I can actually see the Telerik popup's semi-transparent background opening and closing, but can't see my indicator, or anything else I put inside the popup.  I can only see it if it's run on a single page.  Any suggestions on how to implement something similar with the Telerik popup?

Mark
Top achievements
Rank 1
 answered on 08 Oct 2019
6 answers
447 views

Is there a simple way to set the row height? I dropped the CellStyle FontSize lower, but the rows are too far apart. They seem to be double spaced.

Thanks,

Jeff

Jeffrey
Top achievements
Rank 1
 answered on 04 Oct 2019
2 answers
62 views

Hi

I'm trying to create the following behaviour, I would like to highlight the node on a click and then run another command (open another page) when the node is "long pressed". I was looking at the ItemHold event but this doesn't seem to do anything for me. Can you tell me if this is possible using the xamarin treeview telerik control?

Thanks.

Didi
Telerik team
 answered on 03 Oct 2019
11 answers
175 views

In a CellTapped handler, how does one retrieve the date of the tapped cell?

The calendar's selected date will be wrong if the tapped cell become a new selected date.

Lance | Senior Manager Technical Support
Telerik team
 answered on 02 Oct 2019
3 answers
72 views

For some reason my grid is requring to clicks for the user to performe the click action the first click to select the row they are on then another click to perfome the action i have coded behind the function I have the functions under the 

 

But to the end user this feels like they are double clicking as have to select the row first is their any way to get both events to fire same time so that it selects the row and then fires selection changed right away ?

     private async void GrdMultipleBins_SelectionChanged(object sender, Telerik.XamarinForms.DataGrid.DataGridSelectionChangedEventArgs e)
     {

     }

Lance | Senior Manager Technical Support
Telerik team
 answered on 19 Sep 2019
5 answers
288 views

Hello,

by default SegmentedControls SelectedIndex is -1. In my code SegmentedControls ItemsSource is databound to the view model, because the buttons are generated dynamically. If you initialize SelectedIndex with 0 (or greater) before the ItemsSource databound property is allocated in the view model (= null), SegementedControl throws a NullReferenceException. On valid ItemsSource and if you set SelectedIndex to any number greater than the number of items in ItemsSource a NullReferenceException is thrown also.

Xamarin.Forms.Picker uses SelectedIndex too. It ignores the SelectedIndex value if ItemsSource is null or in case SelectedIndex exceeds the number of items in ItemSource, the last item is selected.


Best regards,

Martin

Chuck Giddens
Top achievements
Rank 1
 answered on 19 Sep 2019
7 answers
330 views

I am using the RadTreeView to display driver runs and the associated jobs but once a job is completed the driver can set an option to display or hide the completed jobs.  I am using a "DisplayJob" property to hide the job item if it has been completed (and the hide completed option has been set) as follows;

<DataTemplate x:Key="JobItemTemplate">
    <Grid
        IsVisible="{Binding Item.DisplayJob}"
        RowSpacing="0"
        Padding="0"
        Margin="0"
        BackgroundColor="{Binding Item.JobStatus, Converter={StaticResource StringToColourConverter}}">
 
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="1" />
        </Grid.RowDefinitions>
 
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="60" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="40" />
        </Grid.ColumnDefinitions>
 
        <Label
            Grid.Row="0"
            Grid.RowSpan="3"
            Grid.Column="0"
            Text="{Binding Item.SequenceNumber}"
            TextColor="{StaticResource SunburstOrange}"
            FontSize="36"
            HorizontalTextAlignment="Center"
            WidthRequest="60"
            HorizontalOptions="CenterAndExpand"
            VerticalOptions="CenterAndExpand" />
 
        ...
         
    </Grid>
</DataTemplate>

 

The problem is this does not remove the space the item was taking up in the visual tree.

I found this https://www.telerik.com/forums/radtreeviewitem-visibility in the forum butI'm not sure how to apply to my code.

Lance | Senior Manager Technical Support
Telerik team
 answered on 18 Sep 2019
1 answer
159 views

I am trying to display the keyboard when a user clicks on the row you will see I am using xamrian dialog kit to launch a popup. However I have tried to display the keyboard which you will see below.

 

I tried using the following  but the keyboard is still not showing until the user enters the dialog kit field.

 

           new Entry()
           {
               Keyboard = Keyboard.Numeric
           };

 

 

private async void GrdMultipleBins_SelectionChanged(object sender, Telerik.XamarinForms.DataGrid.DataGridSelectionChangedEventArgs e)
   {
 
       if (grdMultipleBins.SelectedItem != null)
       {
 
           isSplitBin = true;
           var item = grdMultipleBins.SelectedItem as StockTakeAllItems;
           lblBin.Text = item.BinName;
           StockSheetCountItemId = item.StocktakeCountShtItemID;
           lblbarCode.Text = item.Barcode.ToString();
           lblStockCode.Text = item.Code;
           lblDescription.Text = item.Name;
           lblBin.Text = item.BinName;
           lblUomText.Text = item.StockUnitName;
 
           new Entry()
           {
               Keyboard = Keyboard.Numeric
           };
 
           var resultQty = await Plugin.DialogKit.CrossDiaglogKit.Current.GetInputTextAsync("Fuel", $"Please goto Bin {item.BinName} , and enter the visible stock of the item." + item.Name, null, Keyboard.Numeric);
           decimal.TryParse(resultQty, out decimal qtyCounted);
 
           if (resultQty == null) // hack user cancled here
           {
 
 
           }
 
           lblQtys.Text = qtyCounted.ToString();
           StockTakeTransaction stockTake = new StockTakeTransaction();
           stockTake.StockTakeCountSheetItemId = item.StocktakeCountShtItemID;
           stockTake.Quantity = qtyCounted;
 
 
           SaveFunction(sender, e);
       }
 
 
   }
Didi
Telerik team
 answered on 13 Sep 2019
3 answers
153 views

Hello,

I am using Tabview with TabStripOverflowLayout (https://docs.telerik.com/devtools/xamarin/nativecontrols/android/tabview/tab-view-overview)

When click More label,Frame opens.But items title color white also frame's background is white so items titles are invisible.I want to change frame's background color.

How can I change it?

Thank you.

Didi
Telerik team
 answered on 13 Sep 2019
3 answers
257 views

Good Day 

I Managed to do a lot with the Chat Control but i hit a few problems but managed to have work arounds . Now the Chat that is based on text only works perfectly fine and now i am bringing images and i have implemented the Templates for different kinds of messages, images, receiver and Sender and later will do a video if i can make this work on images. The images are not consistent. i am attaching png of small sizes like this one 

Example Image  this image is 61kb , if it is viewed it should show immediately  , but it does not . Let me  explain my process 

Step 1 : i Store an Image file on the server 

 

Step 2 : Make an Entry of that image on the DB (image url ) 

Step 3 :  Make an Entry of just attached image on the Chat Control like this 

 

try
{
     
        Author senderitem = new Author();
        senderitem.Name = model.AUTHOR;
 
        TextMessage textMessage = new TextMessage();
        textMessage.Data = model;
        textMessage.Author = senderitem;
        textMessage.Text = model.ATTACHEMENTURL;
         
    Device.BeginInvokeOnMainThread(() =>
    {
        this.chat.Items.Add(textMessage);
    });
 
}
catch (Exception ex)
{
   await DisplayAlert("Error:".Translate(), ex.Message, "Ok".Translate());
}

 

and after i do that i get an empty white item on the chat control 

Image that shows an empty item

Now when i close my window or open it again i load the chats , it loads the images fast  like as it does here 

Chat Reload

sometimes images load immediately after attaching them, but most of the time i have to close the chat control and open it again and it loads the image images.  i have a video showing the behavior  here 

Video of the Issue

Thanks

 

Lance | Senior Manager Technical Support
Telerik team
 answered on 11 Sep 2019
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?