Click here to Skip to main content
14,108,747 members
   

C#

 
GeneralRe: Visual Studio: detecting Class/Property access during break-mode ? Pin
BillWoodruff9-Jan-19 1:39
mveBillWoodruff9-Jan-19 1:39 
AnswerRe: Visual Studio: detecting Class/Property access during break-mode ? Pin
Super Lloyd10-Jan-19 15:37
memberSuper Lloyd10-Jan-19 15:37 
GeneralRe: Visual Studio: detecting Class/Property access during break-mode ? Pin
BillWoodruff11-Jan-19 6:55
mveBillWoodruff11-Jan-19 6:55 
QuestionSync Database from Local System to server Pin
Member 140373423-Jan-19 20:19
memberMember 140373423-Jan-19 20:19 
AnswerRe: Sync Database from Local System to server Pin
Pete O'Hanlon3-Jan-19 23:44
protectorPete O'Hanlon3-Jan-19 23:44 
QuestionList control Pin
Member 35685022-Jan-19 23:15
memberMember 35685022-Jan-19 23:15 
AnswerRe: List control Pin
Richard MacCutchan3-Jan-19 1:20
protectorRichard MacCutchan3-Jan-19 1:20 
QuestionWhy is the Custom Picker SelectedItem always wrong? Pin
ChristopherLeon2-Jan-19 21:13
memberChristopherLeon2-Jan-19 21:13 
Hello community,

how can I get the selected Item of my custom picker?
I'm facing the problem for hours but have no further idea on how to fix it.
I need the selected value after clicking on the DoneBtn.
test = label.Text;
delivers the right value sometimes, but mostly not.

Thank you in advance!! Smile | :)

Class PickerRendererIos.cs :

//[assembly:ExportRenderer(typeof(MyPicker), typeof(MyiOSPicker))]

[assembly: ExportRenderer(typeof(MyPickerRenderer), typeof(PickerRendererIos))]

namespace DigitalNatives.iOS
{

    public class PickerRendererIos : PickerRenderer, IUIPickerViewDelegate 
    {
        IElementController ElementController => Element as IElementController;
        public String test = "";

        public PickerRendererIos()
        {
        }

        [Export("pickerView:viewForRow:forComponent:reusingView:")]

         public UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
        {
            UILabel label = new UILabel
            {
                TextColor = UIColor.Blue,
                Text = Element.Items[(int)row].ToString(),
                TextAlignment = UITextAlignment.Center,
            };
            test = label.Text;

            Console.WriteLine(Element.Items[(int)row]);

            return label;
        } 


        protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
        {
              base.OnElementChanged(e);

              if (Control != null)
              {
                  UIPickerView pickerView = (UIPickerView)Control.InputView;
                  pickerView.WeakDelegate = this;
                  pickerView.BackgroundColor = UIColor.White;


            /*  var picker = (Picker)this.Element;
                picker.SelectedIndexChanged += (sender, ee) =>
                {
                    //test = picker.Items[picker.SelectedIndex];
                    test = picker.SelectedItem.ToString();
                }; */

            }

            if (e.OldElement != null)
              {
                  var toolbar = (UIToolbar)Control.InputAccessoryView;
                  var doneBtn = toolbar.Items[1];

                  doneBtn.Clicked -= DoneBtn_Clicked;
              }

              if (e.NewElement != null)
              {
                   var text = e.NewElement.SelectedItem;
                  // test = text.ToString();

                  var toolbar = (UIToolbar)Control.InputAccessoryView;
                  var doneBtn = toolbar.Items[1];

                  doneBtn.Clicked += DoneBtn_Clicked;
              }
        }



        void DoneBtn_Clicked(object sender, EventArgs e)
        {
            Console.WriteLine("Clicked!!!!");
            Element.SelectedItem = test;
        }
    }
}

SuggestionRe: Why is the Custom Picker SelectedItem always wrong? Pin
Richard MacCutchan2-Jan-19 22:03
protectorRichard MacCutchan2-Jan-19 22:03 
GeneralRe: Why is the Custom Picker SelectedItem always wrong? (Xamarin Cross Plattform - iOS) Pin
ChristopherLeon2-Jan-19 23:31
memberChristopherLeon2-Jan-19 23:31 
AnswerRe: Why is the Custom Picker SelectedItem always wrong? Pin
Pete O'Hanlon2-Jan-19 23:13
protectorPete O'Hanlon2-Jan-19 23:13 
Questionconvert word document to HTML with special characters Pin
Member 141066092-Jan-19 20:37
memberMember 141066092-Jan-19 20:37 
AnswerRe: convert word document to HTML with special characters Pin
OriginalGriff2-Jan-19 21:17
protectorOriginalGriff2-Jan-19 21:17 
Questionc# error: ...does not implement interface member... Pin
_Q12_1-Jan-19 11:33
member_Q12_1-Jan-19 11:33 
AnswerRe: c# error: ...does not implement interface member... Pin
BillWoodruff1-Jan-19 19:45
mveBillWoodruff1-Jan-19 19:45 
GeneralRe: c# error: ...does not implement interface member... Pin
_Q12_2-Jan-19 0:31
member_Q12_2-Jan-19 0:31 
GeneralRe: c# error: ...does not implement interface member... Pin
BillWoodruff2-Jan-19 0:50
mveBillWoodruff2-Jan-19 0:50 
GeneralRe: c# error: ...does not implement interface member... Pin
_Q12_2-Jan-19 0:59
member_Q12_2-Jan-19 0:59 
GeneralRe: c# error: ...does not implement interface member... Pin
BillWoodruff2-Jan-19 2:58
mveBillWoodruff2-Jan-19 2:58 
AnswerRe: c# error: ...does not implement interface member... Pin
mtoha13-Jan-19 19:33
professionalmtoha13-Jan-19 19:33 
QuestionHow to clone a videoPlayer trackbar? Pin
_Q12_1-Jan-19 4:15
member_Q12_1-Jan-19 4:15 
AnswerRe: How to clone a videoPlayer trackbar? Pin
Dave Kreskowiak1-Jan-19 4:54
mveDave Kreskowiak1-Jan-19 4:54 
GeneralRe: How to clone a videoPlayer trackbar? Pin
_Q12_1-Jan-19 5:03
member_Q12_1-Jan-19 5:03 
GeneralRe: How to clone a videoPlayer trackbar? Pin
Dave Kreskowiak1-Jan-19 5:09
mveDave Kreskowiak1-Jan-19 5:09 
GeneralRe: How to clone a videoPlayer trackbar? Pin
_Q12_1-Jan-19 5:54
member_Q12_1-Jan-19 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 20 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid