Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Segmented Control

$
0
0

I am using this sample for my project: https://github.com/chrispellett/Xamarin-Forms-SegmentedControl
I have added SegmentedControl.cs and SegmentedControlRenderer for iOS as well. Project compiles, works just fine, renders. I have the following in my XAML:

<controls:SegmentedControl x:Name="thisSegment">
            <controls:SegmentedControl.Children>
                <controls:SegmentedControlOption Text="Dev" />
                <controls:SegmentedControlOption Text="QA" />
                <controls:SegmentedControlOption Text="Prod" />
            </controls:SegmentedControl.Children>
        </controls:SegmentedControl>

on code behind:
How do I make one of the segments selected based on a an object passed to this view? as in:
`
public partial class RecordPage : ContentPage
{
ProjectClass currentProject;
    public RecordPage (ProjectClass selectedProject)
    {
        InitializeComponent();
        currentProject= selectedProject;

   /*  
    currentProject has a property called ProjectStatus will have a value of one of "Dev", "QA", "PROD"
    how to bind that to the segmented control so the right one is selected
    */                      
    }

`

Thanks in advance.


Viewing all articles
Browse latest Browse all 77050

Trending Articles