Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
3.50/5 (4 votes)
See more:
Hi,
I am new to this WPF stuff and so I am working on a test app to see who it all works. or doesn't?

I have created a new WPF RibbonMenu application, set up the Ribbon Menu cool tool, added a WPF UserControl to the project, connected to my SQL DB created a View in the DB, then connected to it in the DataSource pain, Dragged the new view onto the UserControl... added a new Window1 to the project and placed the UC on the new window1... so far so good and no errors when built.

Now when I run the app and press a button on the RibbonMenu Window1 is displayed and the fields are all displayed... BUT NO DATA!!!

I opened the MainWindow and placed the UC directly on the Content area... run the app NO DATA... damn!

I placed the DataSet fields directly on the MainWindow Run the app again... YEAH DATA!!!

So what am I missing when placing the DataSet within a UC and the UC into a Window for the fields to be populated?

I have seen several examples of UserControls on the MainWindow and all use a hard coded reference in the XAML of the MainWindow. That is not possible in this app as I will be displaying several different UC's with different datasets within the MainWindow or other windows depending on which button the user has selected (pressed) in the RibbonMenu.

Thanks

Anyone know of an example of how to do this?
Posted
Updated 17-Apr-11 6:15am
v3

If you have the source code for your user control, you might want to attach it to your project and debug it. Specifically, you need to look at the bits that are fetching date into your control - looks like something might be wrong there. You should also take a look at your connection string to make sure that it is pointing to the right server.
 
Share this answer
 
Comments
Squire Dude 17-Apr-11 13:33pm    
Thanks for the thoughts...
I have checked all the connection items etc...
If I place the DataSet (grid or fields) directly onto the MainWindow the data is there. So I must assume that the DataConnection and DataSet are NOT at fault it has something to do with the UserControl portion.
Sergey Alexandrovich Kryukov 17-Apr-11 15:38pm    
That is another correct attempt to help, my 5, but I cannot see what can really help.
Please see OP's comment to my Answer -- do use see any hope. It's hard to imaging what could be missing (no source code), but it must be something very basic...
What do you think?
--SA
Abhinav S 18-Apr-11 0:14am    
Thanks SA saw your answer as well.
From your Question a strange I got a strange impression that you expect WPF to read your mind and figure out what data your want to use for population of your DataGrid instance and how your data should be mapped onto your grid.

I cannot be true, but I got this impression because you never mention data binding, nor you mentioned any your attempts to create any population methods manually. You put amazingly many letters in your Question while not approaching the essence of the problem.

It looks like you need to go back to general concepts.

Look at the Walkthrough: Display Data from a SQL Server Database in a DataGrid Control: http://msdn.microsoft.com/en-us/library/ee340709.aspx[^].

It should give you an idea. Try to find and read other introductory material around System.Windows.Controls.DataGrid (http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.aspx[^]), see some introductory articles:

http://www.wpftutorial.net/DataGrid.html[^],
Introduction to the WPF DataGrid[^],
http://www.c-sharpcorner.com/UploadFile/mahesh/WpfDGP109272009111405AM/WpfDGP1.aspx[^].

You can Google out a lot more — this topic is too popular.

—SA
 
Share this answer
 
Comments
Squire Dude 17-Apr-11 13:38pm    
Sorry if I am not very clear with my question....
I have a New WPF Project with a MainWindow... I have created a DataSource and DataSet which is connected to my SQL DB and can preview the data.

I then place a Grid from the DataSet onto the MainWindow (drag 'n drop) directly and when run the grid is populated.... we have data!

Then I place the Grid from the DataSet onto a UserControl and add the UserControl into the MainWindow and run it... NO DATA????

Hence it is not the DataSet or connection to the DB the issue lies within the UserControl... I am at a loss of where to look next...

Any thoughts?
Sergey Alexandrovich Kryukov 17-Apr-11 13:50pm    
My answer remains the same. Look at the code samples and you will see what's missing. Apparently, I cannot see it, but you will.
--SA
Squire Dude 17-Apr-11 14:28pm    
Hi,
I have looked at each of the solutions you suggest and they ALL place a DataGrid or control on a Window NOT a User Control... I have the DataGrid WORKING correctly too (when placed directly on the MainWindow).

My issues still stands... How to display data (datagrid or control) when placed in a UserControl?

I am unable to display data when the Grid Object is set on a UserControl...
Sergey Alexandrovich Kryukov 17-Apr-11 15:32pm    
There is no difference between you main window and your User Control (and in fact any control parenting the grid) whatsoever.
You're missing something important about controls, not the grid.
I see no effort: what did you try to populate?
--SA
Squire Dude 17-Apr-11 14:29pm    
Oh and none of the solutions suggested worked when placed on a UserContorl either! Sorry... extremely frustrating
Since I am unable to post my code via "Add Comment" I will try again here...
FRIST... code from MainWindow with DataSet.Grid on the window... this displays the data as expected in the Grid.
XML
<r:RibbonWindow x:Class="WpfRibbonApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        Title="MainWindow"
        x:Name="RibbonWindow"
        Width="1024" Height="768" xmlns:my="clr-namespace:WpfRibbonApplication1" Loaded="RibbonWindow_Loaded">
    <r:RibbonWindow.Resources>
        <my:YachtLogPro_SQLDataSet x:Key="yachtLogPro_SQLDataSet" />
        <CollectionViewSource x:Key="vesselDetails_VViewSource" Source="{Binding Path=VesselDetails_V, Source={StaticResource yachtLogPro_SQLDataSet}}" />
    </r:RibbonWindow.Resources>
    <Grid x:Name="LayoutRoot" DataContext="{StaticResource vesselDetails_VViewSource}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <r:Ribbon x:Name="Ribbon" Height="137" VerticalAlignment="Top">
            <r:Ribbon.ApplicationMenu>
                <r:RibbonApplicationMenu SmallImageSource="/WpfRibbonApplication1;component/Images/YachtLog_Icon_Globe2.gif">
                    <r:RibbonApplicationMenuItem Header="Print"
                                                     x:Name="mnuPrint"
                                                    ImageSource="/WpfRibbonApplication1;component/Images/Print-icon.png"
                                                    Click="mnuPrint_Click" />
                    <r:RibbonApplicationMenuItem Header="Help"
                                                     x:Name="mnuHelp"
                                                     ImageSource="/WpfRibbonApplication1;component/Images/Help.png"
                                                     Click="mnuHelp_Click" />
                    <r:RibbonApplicationMenuItem Header="Exit"
                           x:Name="mnuExit"
                           ImageSource="/WpfRibbonApplication1;component/Images/exit.png"
                           Click="mnuExit_Click" />
                </r:RibbonApplicationMenu>
            </r:Ribbon.ApplicationMenu>

            <r:RibbonTab x:Name="tabLogs"
                         Header="Logs"
                         Visibility="Visible" >
                <r:RibbonGroup x:Name="grpNShipsLog" >
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="Black" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                            <GradientStop Color="#FF38E538" Offset="0.006" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                    <r:RibbonButton x:Name="btnSLSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Ships_Log.gif"
                                         Label="Ships"
                                         Click="btnSLSearch_Click" />
                    <r:RibbonButton x:Name="btnSLAdd"
                                         SmallImageSource="/WpfRibbonApplication1;component/Images/Add-icon.png"
                                         Label="Add" />
                    <r:RibbonButton x:Name="btnSLEdit"
                                         SmallImageSource="/WpfRibbonApplication1;component/Images/Edit1.jpg"
                                         Label="Edit" />

                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpNCaptLog" >
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="Black" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                            <GradientStop Color="#FF38E538" Offset="0.006" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                    <r:RibbonButton x:Name="btnCLSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Capt_Log.ico"
                                         Label="Captains"
                                         Click="btnCLSearch_Click_1" />
                    <r:RibbonButton x:Name="btnCLAdd"
                                         SmallImageSource="/WpfRibbonApplication1;component/Images/Add-icon.png"
                                         Label="Add" />
                    <r:RibbonButton x:Name="btnCLEdit"
                                         SmallImageSource="/WpfRibbonApplication1;component/Images/Edit1.jpg"
                                         Label="Edit" />

                </r:RibbonGroup>
            </r:RibbonTab>
            <r:RibbonTab x:Name="tabTrip"
                          Header="Trip Planner" >
                <r:RibbonGroup x:Name="grpTPWayPoint">
                    <r:RibbonButton x:Name="btnWSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/WayPoint-icon.png"
                                         Label="WayPoint" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFDD81E5" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpTrip" >
                    <r:RibbonButton x:Name="btnTSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/TripPlanner.png"
                                         Label="Trip Planner" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFDD81E5" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
            </r:RibbonTab>
            <r:RibbonTab x:Name="tabLockers"
                          Header="Lockers" >
                <r:RibbonGroup x:Name="grpLEngine">
                    <r:RibbonButton x:Name="btnESearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Engine.png"
                                         Label="Engine" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpLSail" >
                    <r:RibbonButton x:Name="btnSSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Sailboat_button.png"
                                         Label="Sail" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpLAccessories" >
                    <r:RibbonButton x:Name="btnASearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Accessories.png"
                                         Label="Accessories" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpLContacts" >
                    <r:RibbonButton x:Name="btnCSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Contacts.jpg"
                                         Label="Contacts" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpLCrew">
                    <r:RibbonButton x:Name="btnLCSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Crew.gif"
                                         Label="Crew" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpLVessels" >
                    <r:RibbonButton x:Name="btnVSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Wheel_button.png"
                                         Label="Vessels"
                                         Click="btnVSearch_Click" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpLInsurance" >
                    <r:RibbonButton x:Name="btnISearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/LargeIcon.png"
                                         Label="Insurance" />
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FFF82D15" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                </r:RibbonGroup>
            </r:RibbonTab>

            <r:RibbonTab x:Name="tabTools"
                              Header="Tools" >
                <r:RibbonGroup x:Name="grpTSafetyCheck" >
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FF9292F2" Offset="0" />
                            <GradientStop Color="#051E1EE8" Offset="0.965" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                    <r:RibbonButton x:Name="btnTSSearch"
                                         LargeImageSource="/WpfRibbonApplication1;component/Images/Life%20Ring.jpg"
                                         Label="Safety Check" />
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpCalculators"
                                    Header="Calculators" >
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FF9292F2" Offset="0" />
                            <GradientStop Color="#051E1EE8" Offset="0.965" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                    <r:RibbonButton x:Name="btnNautical" Label="Nautical" />
                    <r:RibbonButton x:Name="btnStandard" Label="Standard" />
                    <r:RibbonButton x:Name="btnDMStoDD" Label="Convert DMS to DD" />
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpSetUp" >
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FF9292F2" Offset="0" />
                            <GradientStop Color="#051E1EE8" Offset="0.965" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                    <r:RibbonButton x:Name="btnSetUp"
                                        LargeImageSource="/WpfRibbonApplication1;component/Images/YachtMaster_1.gif"
                                        Label="SetUp" />
                </r:RibbonGroup>
                <r:RibbonGroup x:Name="grpOptions" >
                    <r:RibbonGroup.Background>
                        <RadialGradientBrush>
                            <GradientStop Color="#FF9292F2" Offset="0" />
                            <GradientStop Color="#051E1EE8" Offset="0.965" />
                        </RadialGradientBrush>
                    </r:RibbonGroup.Background>
                    <r:RibbonButton x:Name="btnOptions"
                                        LargeImageSource="/WpfRibbonApplication1;component/Images/FlotPlan%201.gif"
                                        Label="Options" />
                </r:RibbonGroup>
            </r:RibbonTab>
            <r:Ribbon.QuickAccessToolBar >
                <r:RibbonQuickAccessToolBar >
                    <r:RibbonButton x:Name="btnQAT"
                                    Label="QAT button"
                                    Click="btnQAT_Click"
                                    SmallImageSource="/WpfRibbonApplication1;component/Images/PJS.ico" />
                    <r:RibbonButton x:Name="btnAbout"
                                    Label="About"
                                    Click="btnAbout_Click"
                                    SmallImageSource="/WpfRibbonApplication1;component/Images/Help.png" />
                </r:RibbonQuickAccessToolBar>
            </r:Ribbon.QuickAccessToolBar>
        </r:Ribbon>
        <DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" Height="200" ItemsSource="{Binding}" Margin="12,37,12,0" Name="vesselDetails_VDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Grid.Row="1">
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="vesselNameColumn" Binding="{Binding Path=VesselName}" Header="Vessel Name" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="vesselTypeColumn" Binding="{Binding Path=VesselType}" Header="Vessel Type" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="powerSailColumn" Binding="{Binding Path=PowerSail}" Header="Power Sail" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="v_RegistrationNumberColumn" Binding="{Binding Path=V_RegistrationNumber}" Header="V Registration Number" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="v_NumberEnginesColumn" Binding="{Binding Path=V_NumberEngines}" Header="V Number Engines" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="homePortColumn" Binding="{Binding Path=HomePort}" Header="Home Port" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="homePortCountryColumn" Binding="{Binding Path=HomePortCountry}" Header="Home Port Country" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="vCommColumn" Binding="{Binding Path=VComm}" Header="VComm" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="vManufactColumn" Binding="{Binding Path=VManufact}" Header="VManufact" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="vModelColumn" Binding="{Binding Path=VModel}" Header="VModel" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="vDesignerColumn" Binding="{Binding Path=VDesigner}" Header="VDesigner" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="vHullNumberColumn" Binding="{Binding Path=VHullNumber}" Header="VHull Number" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hLOAColumn" Binding="{Binding Path=HLOA}" Header="HLOA" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hLaWColumn" Binding="{Binding Path=HLaW}" Header="HLa W" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hBeamColumn" Binding="{Binding Path=HBeam}" Header="HBeam" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hMastColumn" Binding="{Binding Path=HMast}" Header="HMast" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hBoomColumn" Binding="{Binding Path=HBoom}" Header="HBoom" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hDraftColumn" Binding="{Binding Path=HDraft}" Header="HDraft" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hKeelWtColumn" Binding="{Binding Path=HKeelWt}" Header="HKeel Wt" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="hDispColumn" Binding="{Binding Path=HDisp}" Header="HDisp" Width="SizeToHeader" />
                <DataGridCheckBoxColumn x:Name="defaultVesselColumn" Binding="{Binding Path=DefaultVessel}" Header="Default Vessel" Width="SizeToHeader" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</r:RibbonWindow>

--------------------------------------------------------------------------------
That said... when I place the exact same code inside a UserControl it fails to show any data? Here is the code from the UserControl...
XML
<UserControl x:Class="WpfRibbonApplication1.Controls.ucVesselDetail"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="516" d:DesignWidth="557" xmlns:my="clr-namespace:WpfRibbonApplication1.Controls" xmlns:my1="clr-namespace:WpfRibbonApplication1" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <my1:YachtLogPro_SQLDataSet x:Key="yachtLogPro_SQLDataSet" />
        <CollectionViewSource x:Key="vesselDetails_VViewSource" Source="{Binding Path=VesselDetails_V, Source={StaticResource yachtLogPro_SQLDataSet}}" />
    </UserControl.Resources>
    <Grid Height="508" DataContext="{Binding}">
        <Grid DataContext="{StaticResource vesselDetails_VViewSource}" Margin="120,18,0,0" Name="grid1" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Label Content="Vessel Name:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <ComboBox DisplayMemberPath="VesselName" Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" ItemsSource="{Binding}" Margin="3" Name="vesselNameComboBox" VerticalAlignment="Center" Width="120">
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel />
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
            </ComboBox>
            <Label Content="Vessel Type:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="vesselTypeTextBox" Text="{Binding Path=VesselType, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Power Sail:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="powerSailTextBox" Text="{Binding Path=PowerSail, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="V Registration Number:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="3" Name="v_RegistrationNumberTextBox" Text="{Binding Path=V_RegistrationNumber, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="V Number Engines:" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="4" Height="23" HorizontalAlignment="Left" Margin="3" Name="v_NumberEnginesTextBox" Text="{Binding Path=V_NumberEngines, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Home Port:" Grid.Column="0" Grid.Row="5" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="5" Height="23" HorizontalAlignment="Left" Margin="3" Name="homePortTextBox" Text="{Binding Path=HomePort, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Home Port Country:" Grid.Column="0" Grid.Row="6" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="6" Height="23" HorizontalAlignment="Left" Margin="3" Name="homePortCountryTextBox" Text="{Binding Path=HomePortCountry, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="VComm:" Grid.Column="0" Grid.Row="7" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="7" Height="23" HorizontalAlignment="Left" Margin="3" Name="vCommTextBox" Text="{Binding Path=VComm, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="VManufact:" Grid.Column="0" Grid.Row="8" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="8" Height="23" HorizontalAlignment="Left" Margin="3" Name="vManufactTextBox" Text="{Binding Path=VManufact, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="VModel:" Grid.Column="0" Grid.Row="9" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="9" Height="23" HorizontalAlignment="Left" Margin="3" Name="vModelTextBox" Text="{Binding Path=VModel, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="VDesigner:" Grid.Column="0" Grid.Row="10" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="10" Height="23" HorizontalAlignment="Left" Margin="3" Name="vDesignerTextBox" Text="{Binding Path=VDesigner, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="VHull Number:" Grid.Column="0" Grid.Row="11" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="11" Height="23" HorizontalAlignment="Left" Margin="3" Name="vHullNumberTextBox" Text="{Binding Path=VHullNumber, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HLOA:" Grid.Column="0" Grid.Row="12" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="12" Height="23" HorizontalAlignment="Left" Margin="3" Name="hLOATextBox" Text="{Binding Path=HLOA, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HLa W:" Grid.Column="0" Grid.Row="13" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="13" Height="23" HorizontalAlignment="Left" Margin="3" Name="hLaWTextBox" Text="{Binding Path=HLaW, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HBeam:" Grid.Column="0" Grid.Row="14" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="14" Height="23" HorizontalAlignment="Left" Margin="3" Name="hBeamTextBox" Text="{Binding Path=HBeam, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HMast:" Grid.Column="0" Grid.Row="15" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="15" Height="23" HorizontalAlignment="Left" Margin="3" Name="hMastTextBox" Text="{Binding Path=HMast, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HBoom:" Grid.Column="0" Grid.Row="16" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="16" Height="23" HorizontalAlignment="Left" Margin="3" Name="hBoomTextBox" Text="{Binding Path=HBoom, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HDraft:" Grid.Column="0" Grid.Row="17" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="17" Height="23" HorizontalAlignment="Left" Margin="3" Name="hDraftTextBox" Text="{Binding Path=HDraft, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HKeel Wt:" Grid.Column="0" Grid.Row="18" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="18" Height="23" HorizontalAlignment="Left" Margin="3" Name="hKeelWtTextBox" Text="{Binding Path=HKeelWt, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="HDisp:" Grid.Column="0" Grid.Row="19" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="19" Height="23" HorizontalAlignment="Left" Margin="3" Name="hDispTextBox" Text="{Binding Path=HDisp, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Default Vessel:" Grid.Column="0" Grid.Row="20" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <CheckBox Content="" Grid.Column="1" Grid.Row="20" Height="16" HorizontalAlignment="Left" IsChecked="{Binding Path=DefaultVessel, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" Margin="3" Name="defaultVesselCheckBox" VerticalAlignment="Center" />
        </Grid>
    </Grid>
</UserControl>

----------------------------------------------------------------------
I hope this will help you understand my issue...
I believe that it is a conceptual one... the concept of putting data controls bound to a DataSet inside a UserControl?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900