Элементы списка не отображаются в запросе LINQ - PullRequest
0 голосов
/ 14 марта 2020
I am trying to populate a combo-box with the contents from a table 
(`InspectionTypes`) from a LINQ query without success for weeks.  

When I insert a breakpoint, I can see that the data is there and the count 
is correct, but nothing shows up in the drop-down list. I have a desktop 
application with WPF and EF6.  I am currently only working with 
inspectionType10ComboBox but, there are nine other comboboxes that will
function exactly the same and use the exact same data.  I am attempting to 
build a quote based on which inspection(s) have been requested.  

Похоже, ваш пост в основном кодовый; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте некоторые подробности. Похоже, что ваш пост в основном код; пожалуйста, добавьте больше деталей.

**My code behind is as follows:**
    using System;
    using System.Collections.ObjectModel;
    using System.Data;
    using System.Data.Entity;
    using System.Data.SQLite.Linq;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Data.SqlClient;
    using System.Data.Common;
    using System.Globalization;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Navigation;

    namespace WpfApp1
    {
        /// <summary>
        /// Interaction logic for EstimatesScreen.xaml
        /// </summary>
        public partial class EstimatesScreen : Window
        {
            MIDatabase01Entities1 context = new MIDatabase01Entities1();
            CollectionViewSource estimatesViewSource;

            public EstimatesScreen()
            {
                InitializeComponent();
                estimatesViewSource = ((CollectionViewSource) 
    (FindResource("estimatesViewSource")));
                DataContext = this;
                FillComboBoxes();
            }

            private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                System.Windows.Data.CollectionViewSource estimatesViewSource = 
                ((System.Windows.Data.CollectionViewSource) 
    (this.FindResource("estimatesViewSource")));
                context.Estimates.Load();
                estimatesViewSource.Source = context.Estimates.Local;
            }

            private void FillComboBoxes()
            {
                var result = context.InspectionTypes.Select(p => new
                                     {
                                         ID = p.InspectionTypesID,
                                         Name = p.InspectionTypeName
                                     }).ToList();

                inspectionType10ComboBox.ItemsSource = result;
                inspectionType10ComboBox.SelectedValuePath = "ID";
                inspectionType10ComboBox.DisplayMemberPath = "Name";
            }
        }
    }
**My XAML is as follows (edited to reduce size.  Removed "Newgrid which is 
a duplacate if ExistingGrid with "New" prefix for all fields.):**
     <Window x:Class="WpfApp1.EstimatesScreen"
        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:WpfApp1"
        mc:Ignorable="d"
        Title="Monroe Inspections LLC" Height="600" Width="1000" 
    Loaded="Window_Loaded">
    <Window.Resources>
        <CollectionViewSource x:Key="estimatesViewSource" d:DesignSource=" 
    {d:DesignInstance {x:Type local:Estimate}, CreateList=True}"/>
        <CollectionViewSource x:Key="inspectionTypesViewSource" 
    d:DesignSource="{d:DesignInstance {x:Type local:InspectionType}, 
    CreateList=True}"/>
        <RoutedUICommand x:Key="FirstCommand" Text="First"/>
        <RoutedUICommand x:Key="LastCommand" Text="Last"/>
        <RoutedUICommand x:Key="NextCommand" Text="Next"/>
        <RoutedUICommand x:Key="DeleteCommand" Text="Delete"/>
        <RoutedUICommand x:Key="UpdateCommand" Text="Update"/>
        <RoutedUICommand x:Key="AddCommand" Text="Add"/>
        <RoutedUICommand x:Key="CancelCommand" Text="Cancel"/>
        <RoutedUICommand x:Key="PreviousCommand" Text="Previous"/>
        <Style x:Key="NavButton" TargetType="{x:Type Button}" BasedOn=" 
    {x:Null}">
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="FontFamily" Value="Segoe UI Symbol"/>
            <Setter Property="Margin" Value="2,2,2,0"/>
            <Setter Property="Width" Value="40"/>
            <Setter Property="Height" Value="auto"/>
        </Style>
    </Window.Resources>
    <Window.CommandBindings>
        <CommandBinding Command="{StaticResource FirstCommand}" 
    Executed="FirstCommandHandler"/>
        <CommandBinding Command="{StaticResource LastCommand}" 
    Executed="LastCommandHandler"/>
        <CommandBinding Command="{StaticResource NextCommand}" 
    Executed="NextCommandHandler"/>
        <CommandBinding Command="{StaticResource PreviousCommand}" 
    Executed="PreviousCommandHandler"/>
        <CommandBinding Command="{StaticResource DeleteCommand}" 
    Executed="DeleteCommandHandler"/>
        <CommandBinding Command="{StaticResource UpdateCommand}" 
    Executed="UpdateCommandHandler"/>
        <CommandBinding Command="{StaticResource AddCommand}" 
    Executed="AddCommandHandler"/>
        <CommandBinding Command="{StaticResource CancelCommand}" 
    Executed="CancelCommandHandler"/>
    </Window.CommandBindings>
    <Grid Margin="0,0,0,0">
        <Label Content="QUOTES" HorizontalAlignment="Left" 
    VerticalAlignment="Top" Width="224" Height="51" FontWeight="Bold" 
    FontSize="36" Margin="173,9,0,0"/>
        <Button Content="Return" HorizontalAlignment="Left" Margin="10,66,0,0" 
    VerticalAlignment="Top" Height="41" Width="136" Click="Return_Click" 
    FontWeight="Bold" FontFamily="Arial"/>
        <Grid x:Name="ComboboxGrid" DataContext="{StaticResource 
    estimatesViewSource}" HorizontalAlignment="Left" Margin="165,62,0,0" 
    VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Label Content="Existing Quote Customer:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="0" 
    VerticalAlignment="Center"/>
            <ComboBox x:Name="customerComboBox" Grid.Column="1" 
    DisplayMemberPath="Customer" HorizontalAlignment="Left" Height="Auto" 
    ItemsSource="{Binding}" Margin="3" Grid.Row="0" VerticalAlignment="Center" 
    Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
        </Grid>
        <Grid x:Name="ExistingGrid" DataContext="{StaticResource 
    estimatesViewSource}" HorizontalAlignment="Left" Margin="176,112,0,0" 
    VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="115"/>
                <ColumnDefinition Width="230"/>
                <ColumnDefinition Width="210"/>
                <ColumnDefinition Width="82"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
            </Grid.RowDefinitions>
            <Label Content="Customer:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="1" 
    VerticalAlignment="Center"/>
            <TextBox x:Name="customerTextBox" Grid.Column="1" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="1" Text=" 
    {Binding Customer, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="200"/>
            <Label Content="Discount Price:" Grid.Column="2" 
    HorizontalAlignment="Right" Margin="3" Grid.Row="11" 
    VerticalAlignment="Center"/>
            <TextBox x:Name="discountPriceTextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="11" Text=" 
    {Binding DiscountPrice, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <Label Content="Expiration Date:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="11" 
    VerticalAlignment="Center"/>
            <DatePicker x:Name="estExpirationDateDatePicker" Grid.Column="1" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="11" SelectedDate="{Binding 
    EstExpirationDate, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="125"/>
            <Label Content="Quote Accepted:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="12" 
    VerticalAlignment="Center"/>
            <CheckBox x:Name="estimateAcceptedCheckBox" Content="" 
    Grid.Column="1" HorizontalAlignment="Left" IsChecked="{Binding 
    EstimateAccepted, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" Margin="3" Grid.Row="12" 
    VerticalAlignment="Center"/>
            <Label Content="Quote Date:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="10" 
    VerticalAlignment="Center"/>
            <DatePicker x:Name="estimateDateDatePicker" Grid.Column="1" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="10" SelectedDate="{Binding 
    EstimateDate, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="125"/>
            <Label Content="Estimated Price Total:" Grid.Column="2" 
    HorizontalAlignment="Right" Margin="3" Grid.Row="12" 
    VerticalAlignment="Center"/>
            <TextBox x:Name="estimatedPriceTotalTextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="12" Text=" 
    {Binding EstimatedPriceTotal, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <Label Content="Quote ID:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="0" 
    VerticalAlignment="Center"/>
            <TextBox x:Name="estimatesIDTextBox" Grid.Column="1" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="0" Text=" 
    {Binding EstimatesID, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <Label Content="Square Footage:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="5" 
    VerticalAlignment="Center"/>
            <TextBox x:Name="squareFootageTextBox" Grid.Column="1" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="5" Text=" 
    {Binding SquareFootage, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost1TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="1" Text=" 
    {Binding InspectionCost1, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost10TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="10" Text=" 
    {Binding InspectionCost10, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost2TextBox" Grid.Column="3" 
     HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="2" Text=" 
    {Binding InspectionCost2, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost3TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="3" Text=" 
    {Binding InspectionCost3, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost4TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="4" Text=" 
    {Binding InspectionCost4, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost5TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="22" Margin="3" Grid.Row="5" Text=" 
    {Binding InspectionCost5, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost6TextBox" Grid.Column="3" 
     HorizontalAlignment="Left" Height="22" Margin="3" Grid.Row="6" Text=" 
    {Binding InspectionCost6, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost7TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="22" Margin="3" Grid.Row="7" Text=" 
    {Binding InspectionCost7, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost8TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="8" Text=" 
    {Binding InspectionCost8, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <TextBox x:Name="inspectionCost9TextBox" Grid.Column="3" 
    HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="9" Text=" 
    {Binding InspectionCost9, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <ComboBox x:Name="inspectionType1ComboBox"
                Grid.Column="2" Grid.Row="1" 
                Height="24" Width="200" Margin="3" 
                HorizontalAlignment="Left" VerticalAlignment="Center"
                DataContext="inspectionTypesViewSource"
                SelectedValuePath="InspectionTypeName"
                SelectedValue="InspectionTypeName"
                DisplayMemberPath="InspectionTypeName"
                ItemsSource="{Binding result}" >
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>

Это ComboBox, над которым я сейчас работаю. Есть еще девять, которые должны будут работать точно так же с данными дам.

            <ComboBox x:Name="inspectionType10ComboBox"
                Grid.Column="2" Grid.Row="10" 
                Height="24" Width="200" Margin="3" 
                HorizontalAlignment="Left" VerticalAlignment="Center">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType2ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType2" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="2" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType3ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType3" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="3" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType4ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType4" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="4" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType5ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType5" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="5" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType6ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType6" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="6" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType7ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType7" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="7" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType8ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType8" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="8" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <ComboBox x:Name="inspectionType9ComboBox" Grid.Column="2" 
    DisplayMemberPath="InspectionType9" HorizontalAlignment="Left" 
    Height="Auto" ItemsSource="{Binding}" Margin="3" Grid.Row="9" 
    VerticalAlignment="Center" Width="200">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel/>
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <Label Content="Address:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="4" 
    VerticalAlignment="Center"/>
            <TextBox x:Name="addressTextBox" Grid.Column="1" 
    HorizontalAlignment="Left" Height="24" Margin="3" Grid.Row="4" Text=" 
    {Binding Address, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="200"/>
            <Label Content="Inspection Type" Grid.Column="2" 
    HorizontalAlignment="Left" Margin="3" VerticalAlignment="Top" Width="97"/>
            <Label Content="Cost" Grid.Column="3" HorizontalAlignment="Left" 
    Margin="3" VerticalAlignment="Top" Width="47"/>
            <Label Content="Email:" Grid.Column="0" HorizontalAlignment="Left" 
    Margin="3" Grid.Row="2" VerticalAlignment="Center"/>
            <TextBox x:Name="customerEmailTextBox" HorizontalAlignment="Left" 
    Height="23" Margin="3" Grid.Row="2" Text="{Binding CustomerEmail, 
    Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" 
    VerticalAlignment="Center" Width="215" Grid.Column="1"/>
            <Label Content="Crawl Space:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="6" 
    VerticalAlignment="Center"/>
            <CheckBox x:Name="crawalSpaceCheckBox1" Content="" 
    HorizontalAlignment="Left" IsChecked="{Binding CrawalSpace, Mode=TwoWay, 
    NotifyOnValidationError=true, ValidatesOnExceptions=true}" Margin="3" 
    Grid.Row="6" VerticalAlignment="Center" Grid.Column="1"/>
            <TextBox x:Name="additionalDiscountTextBox" Grid.Column="1" 
    HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="8" Text=" 
    {Binding AdditionalDiscount, Mode=TwoWay, NotifyOnValidationError=true, 
    ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="70"/>
            <Label Content="Extra Discount:" Grid.Column="0" 
    HorizontalAlignment="Left" Margin="3" Grid.Row="8" 
    VerticalAlignment="Center"/>
        </Grid>
`NewGrid (removed for  length constraints) goes here.`
        <StackPanel Orientation="Horizontal" Height="35" 
    VerticalAlignment="Bottom" Background="Gainsboro" DataContext=" 
    {StaticResource estimatesViewSource}" Margin="0,0,0,0">
            <Button Name="btnFirst" Content="|◄" Command="{StaticResource 
    FirstCommand}" Style="{StaticResource NavButton}"/>
            <Button Name="btnPrev" Content="◄" Command="{StaticResource 
    PreviousCommand}" Style="{StaticResource NavButton}"/>
            <Button Name="btnNext" Content="►" Command="{StaticResource 
    NextCommand}" Style="{StaticResource NavButton}"/>
            <Button Name="btnLast" Content="►|" Command="{StaticResource 
    LastCommand}" Style="{StaticResource NavButton}"/>
            <Button Name="btnDelete" Content="Delete" Command="{StaticResource 
    DeleteCommand}" FontSize="11" Width="80" Style="{StaticResource 
    NavButton}"/>
            <Button Name="btnAdd" Content="Add New" Command="{StaticResource 
    AddCommand}" FontSize="11" Width="80" Style="{StaticResource NavButton}"/>
            <Button Name="btnUpdate" Content="Save" Command="{StaticResource 
    UpdateCommand}" FontSize="11" Width="80" Style="{StaticResource 
    NavButton}"/>
            <Button Name="btnCancel" Content="Cancel" Command="{StaticResource 
    CancelCommand}" FontSize="11" Width="80" Style="{StaticResource 
    NavButton}"/>
        </StackPanel>
    </Grid>
    </Window>`
`I have been looking at hundreds of samples and I am lost.  The data for 
the ComboBox is in my InspectionTypes table.                               

`

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...