Wpf comboboxes ошибки как это сделать
У меня есть 4 WPF comboBox я хочу добавить данные в XAML у меня есть код, но получаю ошибки.
Содержимое устанавливается в несколько экземпляров. Я хочу установить разные для каждого combobox.
теряюсь в том, где начинается сетка. Это очень ново для меня и пытается сделать то, что должно быть просто. Я не знаю, как обернуть каждый или завершить каждый combobox
полный код ниже
Спасибо
<pre><Window x:Class="WPF_Shift_End_Report.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WPF_Shift_End_Report" mc:Ignorable="d" Title="Shift End Report" Height="550" Width="948" WindowStyle="None"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="44*"/> <ColumnDefinition Width="4*"/> <ColumnDefinition Width="187*"/> </Grid.ColumnDefinitions> <Grid HorizontalAlignment="Left" Height="542" VerticalAlignment="Top" Width="203" Background="#FFBBC9C6" Grid.ColumnSpan="3"> <Button x:Name="btn_Home" Content="Home" HorizontalAlignment="Left" VerticalAlignment="Top" Width="59" Margin="50,180,0,0" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" RenderTransformOrigin="0.458,-0.48"/> <Image x:Name="Home" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="32" Margin="10,177,0,0" Source="ICO/Dog House_40px.png"/> </Grid> <Grid HorizontalAlignment="Left" Height="28" Margin="65,0,0,0" VerticalAlignment="Top" Width="875" RenderTransformOrigin="-0.133,-0.811" Background="#FFBBC9C6" MouseLeftButtonDown="Grid_MouseLeftButtonDown" Grid.ColumnSpan="3"/> <Image x:Name="Exit" HorizontalAlignment="Left" Height="28" VerticalAlignment="Bottom" Width="25" Grid.Column="2" Margin="713,0,0,514" Source="ICO/Delete_29px.png" MouseLeftButtonDown="image_MouseLeftButtonDown" RenderTransformOrigin="1.64,0.5" OpacityMask="Black"/> <Image x:Name="image" HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="119" Source="ICO/nissan-logo.ico" Margin="8,10,0,0"/> <Button x:Name="btn_SSAR" Content="SSAR" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="91,352,0,0" Background="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" BorderBrush="{x:Null}"/> <Button x:Name="btn_Part_Shortage" Content="Part Shortage" HorizontalAlignment="Left" VerticalAlignment="Top" Width="132" Margin="44,225,0,0" Background="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" BorderBrush="{x:Null}"/> <Button x:Name="btn_Attendance" Content="Attendance" HorizontalAlignment="Left" VerticalAlignment="Top" Width="108" Margin="58,272,0,0" Background="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" BorderBrush="{x:Null}"/> <Button x:Name="btn_Hot_Calls" Content="Hot Calls" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="91,307,0,0" Background="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" BorderBrush="{x:Null}"/> <Button x:Name="btn_Restriction" Content="Restriction" HorizontalAlignment="Left" VerticalAlignment="Top" Width="85" Margin="81,426,0,0" Background="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" BorderBrush="{x:Null}"/> <Button x:Name="btn_open_Parts" Content="Open Parts Issue" HorizontalAlignment="Left" VerticalAlignment="Top" Width="138" Margin="44,382,0,0" Background="{x:Null}" Foreground="White" FontSize="16" FontWeight="Bold" BorderBrush="{x:Null}" Grid.ColumnSpan="2"/> <Image x:Name="PartShortage" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="36" Margin="10,225,0,0" RenderTransformOrigin="-5.056,0.638" Source="ICO/Administrative Tools_40px.png"/> <Image x:Name="Restriction" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="36" Margin="10,445,0,0" Source="ICO/Medical 2.jpg" RenderTransformOrigin="0.556,-0.76"/> <Image x:Name="Attendance" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="36" Margin="10,272,0,0" RenderTransformOrigin="0.583,2.84" Source="ICO/Add User Group Man Man_40px.png"/> <Image x:Name="image4" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="36" Margin="8,352,0,0" RenderTransformOrigin="-6.667,0.04"/> <Image x:Name="image5" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="36" Margin="10,401,0,0" RenderTransformOrigin="0.5,1.48"/> <Image x:Name="HotCalls" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="36" Margin="10,307,0,0" RenderTransformOrigin="-1.63,0.65" Source="ICO/White flame.png" OpacityMask="#FF891B15"/> <Grid HorizontalAlignment="Left" Height="77" VerticalAlignment="Top" Width="737" Grid.Column="2" Margin="11,28,0,0" Background="#FF23A2B6"> <ComboBox x:Name="comboBox2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="73" Margin="150,45,0,0"/> <ComboBoxItem Content="X"/> <ComboBoxItem Content="Y"/> <ComboBoxItem Content="Z"/> <ComboBox x:Name="comboBox3" HorizontalAlignment="Left" Margin="257,45,0,0" VerticalAlignment="Top" Width="78" RenderTransformOrigin="-0.013,0.409"/> <ComboBoxItem Content="a"/> <ComboBoxItem Content="s"/> <ComboBoxItem Content="d"/> <ComboBox x:Name="comboBox4" HorizontalAlignment="Left" VerticalAlignment="Top" Width="79" Margin="363,45,0,0"/> <ComboBoxItem Content="f"/> <ComboBoxItem Content="g"/> <ComboBoxItem Content="h"/> <ComboBox x:Name="comboBox5" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="486,45,0,0"/> <ComboBoxItem Content="j"/> <ComboBoxItem Content="k"/> <ComboBoxItem Content="l"/> <ComboBox> <ComboBox x:Name="comboBox6" HorizontalAlignment="Left" VerticalAlignment="Top" Width="86" Margin="632,45,0,0" RenderTransformOrigin="0.802,0.545"/> </Grid> <DatePicker HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="2" Margin="31,68,0,0"/> </Grid> </Window>
Что я уже пробовал:
не могу найти пример comboboxs вместе в группе.
Graeme_Grant
Почему вам нужны все 5 комбо-боксов с одинаковым содержимым? Почему вы хотите жестко закодировать содержимое ComboBox в Xaml?