Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net

Set value in a ComboBox ComboboxItem



Dieses Beispiel zeigt wie man einen Eintag in einem Auswahlfeld / ComboBox in UWP und WPF per XAML und per Code erstellen kann



UWP, WPF, Select Feld Dropdown Auswahl



You place in the ComboBox within several ComboBoxItems


<ComboBox Grid.Row="1" Grid.Column="1" x:Name="CameraNr"  Width="200" HorizontalAlignment="Left" VerticalAlignment="Stretch"  VerticalContentAlignment="Center"

                      SelectedIndex="1" >

                <ComboBoxItem HorizontalContentAlignment="Center" Tag="1" Content="Camera1"></ComboBoxItem>

                <ComboBoxItem HorizontalContentAlignment="Center" Tag="2" Content="Camera2"></ComboBoxItem>




Setting in the code


You can add the ComboBoxItem in the C-code by creating it at run time with new ComboBoxItem() and then . Content="abc" and . Tag="No1"

private async Task<bool> Init_List_Cameras()


            //----< @Loop: all Cameras >----

            var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

            for(int iDevice=0;iDevice<allVideoDevices.Count;iDevice++)


                //< add comboBoxItem >

                DeviceInformation camera = allVideoDevices[iDevice];

                string sCameraName = camera. Name;

                ComboBoxItem itemCamera = new ComboBoxItem();

                itemCamera.Content = sCameraName;



                //</ add comboBoxItem >


            //----</ @Loop: all Cameras >----

            //int Set_CameraNr = Convert.ToInt32(ApplicationData.Current.LocalSettings.Values["Set_CameraNr"]. ToString());

            return true;



Set value in a ComboBox ComboboxItem
UWP: List as sortable text array
UWP: How to Add single lines to a combo box
UWP: Set Focus on Control at Runtime
UWP CodeSample: ListFile in Folder
UWP: View a video from the Internet
UWP: How to Load the web page in a webview control
UWP Code: Webcam Recorder in mp4


Contact for Jobs, Project Requests: