0
votes

I have a combobox control declared in XAML. Here is the code:

<border:SfBorder
                    BorderColor="{Binding Source={x:Reference DefectPicker}, Path=IsFocused, Converter={StaticResource ColorConverter}, ConverterParameter=3}"
                    Style="{StaticResource BusinessFormBorderStyle}">
                <combobox:SfComboBox
                            x:Name="DefectPicker"
                            SelectedValue="{Binding Defect, Mode=TwoWay}"
                            Style="{StaticResource ComboBoxStyle}"
                            Watermark="Enter Defect"
                            VerticalOptions="CenterAndExpand">
                    <combobox:SfComboBox.ComboBoxSource>
                        <ListCollection:List x:TypeArguments="x:String">
                            <x:String>Sole Proprietorship</x:String>
                            <x:String>Partnership</x:String>
                            <x:String>Limited Partnership</x:String>
                            <x:String>Corporation</x:String>
                            <x:String>Limited Liability Company</x:String>
                            <x:String>Cooperative</x:String>
                        </ListCollection:List>
                    </combobox:SfComboBox.ComboBoxSource>
                    <combobox:SfComboBox.DropDownButtonSettings>
                        <combobox:DropDownButtonSettings>
                            <combobox:DropDownButtonSettings.View>
                                <Label
                                                FontFamily="{StaticResource FontIcons}"
                                                FontSize="25"
                                                HorizontalTextAlignment="Center"
                                                Text="{StaticResource DropDownButtonIcon}"
                                                TextColor="{DynamicResource Gray-600}"
                                                VerticalTextAlignment="Center" />
                            </combobox:DropDownButtonSettings.View>
                        </combobox:DropDownButtonSettings>
                    </combobox:SfComboBox.DropDownButtonSettings>
                </combobox:SfComboBox>
            </border:SfBorder>

How can I declare this code in C#. Exact fields mentioned here ! It be a new method for me to learn !

1

1 Answers

0
votes

Due to i do not find the Converter, Style and something else in your xaml, I make a simple structure in code. You could take the code below for reference.

List<string> list = new List<string>()
{
    "Sole Proprietorship", "Partnership","Limited Partnership","Corporation","Limited Liability Company","Cooperative"
};


SfBorder sfBorder = new SfBorder() { BorderColor = Color.Red };

SfComboBox sfComboBox = new SfComboBox();
sfComboBox.ComboBoxSource = list;


sfBorder.Content = sfComboBox;

this.Content = sfBorder;

Screenshot:

enter image description here