tags:

views:

196

answers:

4

Hi

I'm new in WPF so I try to create a WPF UserControl. My problem is about the style of the user control I've Created. On a design time I got this error message

Can only base on a Style with target type that is base type 'RichTextBox'.

at System.Windows.Style.Seal() at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache) at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp) at System.Windows.FrameworkElement.UpdateStyleProperty() at System.Windows.TreeWalkHelper.InvalidateStyleAndReferences(DependencyObject d, ResourcesChangeInfo info, Boolean containsTypeOfKey) at System.Windows.TreeWalkHelper.OnResourcesChanged(DependencyObject d, ResourcesChangeInfo info, Boolean raiseResourceChangedEvent) at System.Windows.TreeWalkHelper.OnResourcesChangedCallback(DependencyObject d, ResourcesChangeInfo info) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker1._VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.VisitNode(FrameworkElement fe) at System.Windows.DescendentsWalker1.VisitNode(DependencyObject d) at System.Windows.DescendentsWalker1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren) at System.Windows.DescendentsWalker1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren) at System.Windows.DescendentsWalker1.IterateChildren(DependencyObject d) at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode) at System.Windows.TreeWalkHelper.InvalidateOnResourcesChange(FrameworkElement fe, FrameworkContentElement fce, ResourcesChangeInfo info) at System.Windows.ResourceDictionary.NotifyOwners(ResourcesChangeInfo info) at System.Windows.ResourceDictionary.EndInit() at MS.Internal.Host.Designer.OnAppResourcesChanged(Object sender, EventArgs e) at MS.Internal.Host.Designer.get_View() at MS.Internal.Designer.VSDesigner.Load() at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.Load() at MS.Internal.Designer.DesignerPane.LoadDesignerView()

And at a run time An error Message type XamlParseException Occurs and the message is:

Cannot create instance of 'RichTextBox' defined in assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Can only base on a Style with target type that is base type 'RichTextBox'. Error at object 'System.Windows.Controls.Grid' in markup file 'NameSpace;component/usercontrols /myusercontrol.xaml' Line 125 Position 14.

My user control have 3 richtextboxes 1 textbox and 3 dropdownlist and about 10 buttons. I think The problem is about to define the style of my user control, can anyone help me to do this.

Thanks

A: 

It use some style created. And What I don't Understand is when I Use it in a single window independent Project it works well. But in the project I need to use It doesn't work.

The project uses also RibbonWindow, It doesn't work nor in a classic WPF Window in the concerned project.

Here's the Xaml Code

Cancel OK Client Name : ... ... Activity Type : Society Type : Currency : Collaborateur : ... ... ... ... Gestionnaire : Responsable Client : Commercial : Client Acc No : Cash Debt Acc No : Cash TVA Acc No : Cash Others Acc No : Honorary Acc No : Fees Acc No : S TVA Acc No : N TVA Acc No : Collect TVA Acc No : + - + - Invoicing Type : Global By Debtor File SettlementRemarks : SettlementTimeLimit : SummaryEditionPeriod :

                        <ComboBox Grid.Column="1" Grid.Row="4" Height="Auto" HorizontalAlignment="Stretch" Margin="2" Name="_SummaryEditionPeriod" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto" />
                        <CheckBox Grid.Column="1" Grid.Row="5" Margin="2" Name="_Compensable" VerticalAlignment="Center">Compensable</CheckBox>
                        <CheckBox Grid.Column="1" Grid.Row="6" Margin="2" Name="_EditionofCertificates" VerticalAlignment="Center">CheckBox</CheckBox>
                        <Label Grid.Row="8" HorizontalAlignment="Stretch" Name="LabelVATRate" VerticalContentAlignment="Center" Width="Auto">VATRate :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="8" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="100" x:Name="_VATRate"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="9" HorizontalAlignment="Stretch" Name="LabelPreliminaryCharges" VerticalContentAlignment="Center" Width="Auto">PreliminaryCharges :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="9" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="999999999999999999999999999" x:Name="_PreliminaryCharges"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="10" HorizontalAlignment="Stretch" Name="LabelDebtorChargeType" VerticalContentAlignment="Center" Width="Auto" Height="Auto" VerticalAlignment="Stretch">DebtorChargeType :</Label>
                        <ComboBox Grid.Row="10" Name="_DebtorChargeType" VerticalContentAlignment="Center" Grid.Column="1" Height="Auto" VerticalAlignment="Stretch" Margin="2" />
                        <Label Grid.Row="11" HorizontalAlignment="Stretch" Name="LabelPenaltyChargeRate" VerticalContentAlignment="Center" Width="Auto">PenaltyChargeRate :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="11" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="999999999999999999999999999" x:Name="_PenaltyChargeRate"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="12" HorizontalAlignment="Stretch" Name="LabelVATPenaltyCharge" VerticalContentAlignment="Center" Width="Auto">VATPenaltyCharge :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="12" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="999999999999999999999999999" x:Name="_VATPenaltyCharge"/>
                        </WindowsFormsHost>
                        <CheckBox Grid.Row="13" Name="_IsLitigation" Grid.Column="1" VerticalAlignment="Center" Margin="2">Compensable</CheckBox>
                        <CheckBox Grid.Row="14" Name="_RemitPenaltyCharge" Grid.Column="1" Margin="2" VerticalAlignment="Center">RemitPenaltyCharge</CheckBox>

                    </Grid>
                </GroupBox>
                <Grid Grid.Column="1" HorizontalAlignment="Stretch" Name="GridDetails" Width="Auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="300*" />
                        <RowDefinition Height="338.08*" />
                    </Grid.RowDefinitions>
                    <GroupBox Header="Charges" Height="Auto" Name="GroupBoxRecoveryCharges" TabIndex="0" VerticalAlignment="Stretch">
                        <Grid Height="Auto" Name="GridCharges" Width="Auto">
                            <my:DataGrid AutoGenerateColumns="False" Margin="2" Name="DataGridCharges" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="False" CanUserSortColumns="False" />
                        </Grid>
                    </GroupBox>
                    <GroupBox Header="Special Charges" Name="GroupBoxSpecialCharges" TabIndex="0" VerticalContentAlignment="Center" Grid.Row="1">
                        <Grid Height="Auto" Name="GridSpecialCharges" Width="Auto">
                            <my:DataGrid AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="False" CanUserSortColumns="False" Height="Auto" Name="DataGridSpecialCharges" Width="Auto" Margin="2" />
                        </Grid>
                    </GroupBox>
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="Status" Name="TabItemClient_Status">
            <GroupBox Header="Client Status" Height="Auto" Name="GroupClientStatus" TabIndex="0" Width="Auto">
                <Grid Height="Auto" Name="GridClientStatus" Width="Auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="540*" />
                        <RowDefinition Height="Auto" MinHeight="28" />
                    </Grid.RowDefinitions>
                    <my:DataGrid 
Didier
Please edit your question to provide extra information instead of posting it as an answer. stackoverflow is not the same as a forum.
Lars Truijens
Also, the xaml seems to be incomplete. You haven't given us the xaml for the styles you are trying to use - what you have provided makes little sense on its own.
TabbyCool
A: 

Ok

When I paste the complete xaml code The header part gives the wrong text "Cancel OK Client Name : ... ... " Here's the body part

<DockPanel LastChildFill="True" Name="MainDockPanel" VerticalAlignment="Stretch" Height="Auto" Margin="0,25,0,0">
    <Grid DockPanel.Dock="Bottom" Height="Auto" Name="GridOptions" Style="{DynamicResource GridBottomButtonStyle}" Width="Auto">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="631*" />
            <ColumnDefinition MaxWidth="94" MinWidth="94" Width="94*" />
            <ColumnDefinition MaxWidth="94" MinWidth="94" Width="94" />
            <ColumnDefinition MaxWidth="80" MinWidth="80" Width="80*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="36*" MinHeight="29" />
            <RowDefinition Height="0*" />
        </Grid.RowDefinitions>
        <Button Cursor="Hand" Grid.Column="3" Margin="8,5" Name="ButtonCancel" Style="{DynamicResource ButtonStyle}" Width="65">Cancel</Button>
        <Button Grid.Column="2" HorizontalAlignment="Right" Margin="0,5,9,5" Name="ButtonOK" Style="{DynamicResource ButtonStyle}" Width="75">OK</Button>
    </Grid>
    <TabControl Height="Auto" Name="TabControlClient_Service" Width="Auto" Margin="2">
        <TabItem Header="Details" Name="TabItemClient_Service">
            <Grid Height="Auto" Name="GridMainClient_Service" Width="Auto">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="389*" />
                    <ColumnDefinition Width="637*" />
                </Grid.ColumnDefinitions>
                <Grid Name="GridClient_Service">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" MinHeight="0" />
                        <RowDefinition Height="Auto" MinHeight="155" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="462*" />
                    </Grid.ColumnDefinitions>
                    <GroupBox Header="Reference" Name="GroupBoxReference">
                        <Grid Name="GridReference">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" MinWidth="87" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" MinHeight="28" />
                                <RowDefinition Height="Auto" MinHeight="28" />
                                <RowDefinition Height="Auto" MinHeight="26" />
                                <RowDefinition Height="Auto" MinHeight="28" />
                            </Grid.RowDefinitions>
                            <Label Grid.Row="1" HorizontalAlignment="Stretch" Margin="2" Name="LabelName" VerticalContentAlignment="Center" Width="Auto">Client Name :</Label>
                            <Grid Grid.Column="1" Grid.Row="1" Name="GridName" Height="Auto" VerticalAlignment="Stretch">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <ComboBox Margin="2" Name="_Name" VerticalContentAlignment="Center" />
                                <Button Margin="2" Name="ButtonModifyClient" Grid.Column="1" MinWidth="25">...</Button>
                                <Button Margin="2" Name="ButtonAddClient" Grid.Column="2" MinWidth="25">...</Button>
                            </Grid>
                            <Label Grid.Row="2" Height="Auto" HorizontalAlignment="Stretch" Margin="2" Name="LabelFK_Ref_Activity" VerticalContentAlignment="Center" Width="Auto">Activity Type :</Label>
                            <Label Grid.Row="3" Height="Auto" HorizontalAlignment="Stretch" Margin="2,2,0,0" Name="LabelFK_SocietyType" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Society Type :</Label>
                            <Label Grid.Row="4" HorizontalAlignment="Stretch" Name="LabelFK_Currency" VerticalContentAlignment="Center" Width="Auto">Currency :</Label>
                            <ComboBox Grid.Column="1" Grid.Row="2" Height="Auto" Margin="2" Name="_FK_Ref_Activity" Style="{DynamicResource ComboBoxStyle}" VerticalAlignment="Stretch" />
                            <ComboBox Grid.Column="1" Grid.Row="3" Height="Auto" Margin="2" Name="_FK_SocietyType" Style="{DynamicResource ComboBoxStyle}" VerticalAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="4" Height="Auto" Margin="2" Name="_FK_Currency" Style="{DynamicResource TextBoxStyle}" VerticalAlignment="Stretch" IsReadOnly="True" />
                        </Grid>
                    </GroupBox>
                    <GroupBox Style="{DynamicResource GroupboxStyle}" Header="Commercial" Name="GroupBoxCommercial" Grid.Row="1">
                        <Grid Name="GridCommercial">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="120" Width="Auto" />
                                <ColumnDefinition />
                                <ColumnDefinition MinWidth="30" Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                            </Grid.RowDefinitions>
                            <Label Style="{DynamicResource LabelStyle}" Grid.Row="2" Height="Auto" HorizontalAlignment="Stretch" Name="LabelFK_Collaborateur" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Collaborateur :</Label>
                            <ComboBox Style="{DynamicResource ComboBoxStyle}" Grid.Column="1" Height="Auto" Name="_FK_Gestionnaire"  VerticalAlignment="Stretch" VerticalContentAlignment="Center" Margin="2"></ComboBox>
                            <Button Name="ButtonViewFK_Gestionnaire" Style="{DynamicResource ButtonStyle}" Grid.Column="2" Height="Auto" VerticalAlignment="Stretch" Margin="2">...</Button>
                            <ComboBox Style="{DynamicResource ComboBoxStyle}" Grid.Column="1" Grid.Row="1" Height="Auto" Name="_FK_Commercial"  VerticalAlignment="Stretch" VerticalContentAlignment="Center" Margin="2"></ComboBox>
                            <Button HorizontalAlignment="Stretch" Margin="2" Name="ButtonViewFK_Commercial" Style="{DynamicResource ButtonStyle}" Width="Auto" Grid.Column="2" Height="Auto" Grid.Row="1" VerticalAlignment="Stretch">...</Button>
                            <ComboBox Style="{DynamicResource ComboBoxStyle}" Grid.Column="1" Grid.Row="2" Height="Auto" Name="_FK_Collaborateur"  VerticalAlignment="Stretch" VerticalContentAlignment="Center" Margin="2"></ComboBox>
                            <Button Style="{DynamicResource ButtonStyle}" Grid.Column="2" Grid.Row="2" Name="ButtonViewFK_Collaborateur" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Margin="2">...</Button>
                            <TextBox Style="{DynamicResource TextBoxStyle}" Grid.Column="1" Grid.Row="3" Name="_FK_Ref_ResponsableClient"  VerticalContentAlignment="Center" Height="Auto" VerticalAlignment="Stretch" Margin="2" IsReadOnly="True"></TextBox>
                            <Button Style="{DynamicResource ButtonStyle}" Grid.Column="2" Grid.Row="3" Height="Auto" HorizontalAlignment="Stretch" Name="ButtonViewFK_Ref_ResponsableClient" Width="Auto" VerticalAlignment="Stretch" Margin="2">...</Button>
                            <Label Style="{DynamicResource LabelStyle}" Height="Auto" HorizontalAlignment="Stretch" Name="LabelFK_Gestionnaire" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Gestionnaire :</Label>
                            <Label Style="{DynamicResource LabelStyle}" Grid.Row="3" Height="Auto" HorizontalAlignment="Stretch" Name="LabelFK_Ref_ResponsableClient" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Responsable Client :</Label>
                            <Label Style="{DynamicResource LabelStyle}" Grid.Row="1" HorizontalAlignment="Stretch" Name="LabelFK_Commercial" VerticalContentAlignment="Center" Width="Auto" Height="Auto" VerticalAlignment="Stretch">Commercial :</Label>
                        </Grid>
                    </GroupBox>
                    <GroupBox Header="Accounting" HorizontalAlignment="Stretch" Name="GroupBoxAccounting" Style="{DynamicResource GroupboxStyle}" Width="Auto" Grid.Row="2">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="0" Width="Auto" />
                                <ColumnDefinition MinWidth="0" Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="20" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                                <RowDefinition Height="Auto" MinHeight="30" />
                            </Grid.RowDefinitions>
                            <Label Height="Auto" HorizontalAlignment="Stretch" Name="LabelClientAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Client Acc No :</Label>
                            <TextBox Grid.Column="1" Height="Auto" Name="_ClientAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <Label Grid.Row="1" Height="Auto" HorizontalAlignment="Stretch" Name="LabelCashDebtAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Cash Debt Acc No :</Label>
                            <Label Grid.Row="2" Height="Auto" HorizontalAlignment="Stretch" Name="LabelCashCPTVAAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Cash TVA Acc No :</Label>
                            <Label Grid.Row="3" Height="Auto" HorizontalAlignment="Stretch" Name="LabelCashOthersAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Cash Others Acc No :</Label>
                            <TextBox Grid.Column="1" Grid.Row="1" Height="Auto" Name="_CashDebtAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="2" Height="Auto" Name="_CashCPTVAAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="3" Height="Auto" Name="_CashOthersAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <Label Grid.Row="4" Height="Auto" HorizontalAlignment="Stretch" Name="LabelHonoraryAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Honorary Acc No :</Label>
                            <Label Grid.Row="5" Height="Auto" HorizontalAlignment="Stretch" Name="LabelFileFeeAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Fees Acc No :</Label>
                            <Label Grid.Row="6" Height="Auto" HorizontalAlignment="Stretch" Name="LabelSTVAAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">S TVA Acc No :</Label>
                            <Label Grid.Row="7" Height="Auto" HorizontalAlignment="Stretch" Name="LabelNTVAAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">N TVA Acc No :</Label>
                            <Label Grid.Row="8" Height="Auto" HorizontalAlignment="Stretch" Name="LabelCollectTVAAccNo" Style="{DynamicResource LabelStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">Collect TVA Acc No :</Label>
                            <TextBox Grid.Column="1" Grid.Row="4" Height="Auto" Name="_HonoraryAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="5" Height="Auto" Name="_FileFeeAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="6" Height="Auto" Name="_STVAAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="7" Height="Auto" Name="_NTVAAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                            <TextBox Grid.Column="1" Grid.Row="8" Height="Auto" Name="_CollectTVAAccNo" Style="{DynamicResource TextboxStyle}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" />
                        </Grid>
                    </GroupBox>
                </Grid>
                <Grid Grid.Column="1" Height="Auto" Name="GridOthers" VerticalAlignment="Stretch">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="302" />
                        <RowDefinition Height="333.08*" />
                    </Grid.RowDefinitions>
                    <GroupBox Style="{DynamicResource GroupboxStyle}" Header="Contact Persons" Name="GroupBoxContactPersons">
                        <Grid Name="GridContactPersons">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="362*" />
                                <ColumnDefinition MinWidth="34" Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <my:DataGrid AutoGenerateColumns="False" Margin="2" Name="DataGridContactPerson" SelectionMode="Single" SelectionUnit="FullRow" IsEnabled="True" />
                            <Grid Grid.Column="1" Margin="2" Name="GridContactPersonsButton">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="30" Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" MinHeight="28" />
                                    <RowDefinition Height="Auto" MinHeight="28" />
                                    <RowDefinition Height="27*" />
                                    <RowDefinition Height="179.17*" />
                                </Grid.RowDefinitions>
                                <Button Style="{DynamicResource ButtonStyle}" Height="Auto" Margin="2" Name="ButtonAddContactPerson" VerticalAlignment="Stretch">+</Button>
                                <Button Style="{DynamicResource ButtonStyle}" Grid.Row="1" Height="Auto" Margin="2" Name="ButtonModifyContactPerson">*</Button>
                                <Button Name="ButtonRemoveContactPerson" Style="{DynamicResource ButtonStyle}" Grid.Row="2" Margin="2" Height="Auto" VerticalAlignment="Stretch">-</Button>
                            </Grid>
                        </Grid>
                    </GroupBox>
                    <GroupBox Header="Address" Name="GroupBoxAddress" Style="{DynamicResource GroupboxStyle}" Grid.Row="1">
                        <Grid Name="GridAddress">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="362*" />
                                <ColumnDefinition MinWidth="34" Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <my:DataGrid AutoGenerateColumns="False" Margin="2" Name="DataGridAddress" />
                            <Grid Grid.Column="1" Margin="2" Name="GridContactPersonButton">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="30" Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" MinHeight="29" />
                                    <RowDefinition Height="Auto" MinHeight="29" />
                                    <RowDefinition Height="30*" />
                                    <RowDefinition Height="243.25*" />
                                </Grid.RowDefinitions>
                                <Button Height="Auto" Margin="2" Name="ButtonAddAddress" VerticalAlignment="Stretch">+</Button>
                                <Button Grid.Row="1" Height="Auto" Margin="2" Name="ButtonModifyAddress" >*</Button>
                                <Button HorizontalAlignment="Stretch" Margin="2" Name="ButtonRemoveAddress" Width="Auto" Grid.Row="2">-</Button>
                            </Grid>
                        </Grid>
                    </GroupBox>
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="Tariff Details" Name="TabItemClient_Tariff">
            <Grid Height="Auto" Name="GridMainTariffDetails" Width="Auto">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="437*" />
                    <ColumnDefinition Width="589*" />
                </Grid.ColumnDefinitions>
                <GroupBox Header="Details" Height="Auto" Name="GroupBoxTariffDetails" VerticalAlignment="Stretch">
                    <Grid Name="GridTariffDetails" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="87" Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" MinHeight="6" />
                            <RowDefinition Height="Auto" MinHeight="28" />
                            <RowDefinition Height="100" MinHeight="28" />
                            <RowDefinition Height="Auto" MinHeight="26" />
                            <RowDefinition Height="Auto" MinHeight="28" />
                            <RowDefinition Height="Auto" MinHeight="20" />
                            <RowDefinition Height="Auto" MinHeight="20" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" MinHeight="28" />
                            <RowDefinition Height="Auto" ForceCursor="False" MinHeight="28" />
                            <RowDefinition Height="Auto" MinHeight="28" />
                            <RowDefinition Height="Auto" MinHeight="28" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Label Grid.Row="1" HorizontalAlignment="Stretch" Margin="2" Name="LabelInvoicingType" VerticalContentAlignment="Center" Width="Auto">Invoicing Type :</Label>
                        <Grid Grid.Column="1" Grid.Row="1" Height="Auto" Margin="2" Name="GridInvoicingType" VerticalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <RadioButton Grid.Column="0" Margin="2" Name="_Global" VerticalContentAlignment="Center">Global</RadioButton>
                            <RadioButton Grid.Column="1" Margin="2" Name="_ByDebtor_File">By Debtor File</RadioButton>
                        </Grid>
                        <Label Grid.Row="2" Height="Auto" HorizontalAlignment="Stretch" Margin="2" Name="LabelSettlementRemarks" VerticalContentAlignment="Top" Width="Auto">SettlementRemarks :</Label>
                        <TextBox AcceptsReturn="True" MaxLength="200" Name="_SettlementRemarks" TextWrapping="Wrap" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Auto" Grid.Column="1" Grid.Row="2" />
                        <Label Grid.Row="3" Height="Auto" HorizontalAlignment="Stretch" Margin="2,2,0,0" Name="LabelSettlementTimeLimit" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto">SettlementTimeLimit :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="3" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="0" Maximum="500" x:Name="_SettlementTimeLimit"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="4" HorizontalAlignment="Stretch" Name="LabelSummaryEditionPeriod" VerticalContentAlignment="Center" Width="Auto">SummaryEditionPeriod :</Label>


                        <ComboBox Grid.Column="1" Grid.Row="4" Height="Auto" HorizontalAlignment="Stretch" Margin="2" Name="_SummaryEditionPeriod" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Width="Auto" />
                        <CheckBox Grid.Column="1" Grid.Row="5" Margin="2" Name="_Compensable" VerticalAlignment="Center">Compensable</CheckBox>
                        <CheckBox Grid.Column="1" Grid.Row="6" Margin="2" Name="_EditionofCertificates" VerticalAlignment="Center">CheckBox</CheckBox>
                        <Label Grid.Row="8" HorizontalAlignment="Stretch" Name="LabelVATRate" VerticalContentAlignment="Center" Width="Auto">VATRate :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="8" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="100" x:Name="_VATRate"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="9" HorizontalAlignment="Stretch" Name="LabelPreliminaryCharges" VerticalContentAlignment="Center" Width="Auto">PreliminaryCharges :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="9" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="999999999999999999999999999" x:Name="_PreliminaryCharges"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="10" HorizontalAlignment="Stretch" Name="LabelDebtorChargeType" VerticalContentAlignment="Center" Width="Auto" Height="Auto" VerticalAlignment="Stretch">DebtorChargeType :</Label>
                        <ComboBox Grid.Row="10" Name="_DebtorChargeType" VerticalContentAlignment="Center" Grid.Column="1" Height="Auto" VerticalAlignment="Stretch" Margin="2" />
                        <Label Grid.Row="11" HorizontalAlignment="Stretch" Name="LabelPenaltyChargeRate" VerticalContentAlignment="Center" Width="Auto">PenaltyChargeRate :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="11" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="999999999999999999999999999" x:Name="_PenaltyChargeRate"/>
                        </WindowsFormsHost>
                        <Label Grid.Row="12" HorizontalAlignment="Stretch" Name="LabelVATPenaltyCharge" VerticalContentAlignment="Center" Width="Auto">VATPenaltyCharge :</Label>
                        <WindowsFormsHost Grid.Column="1" Height="Auto" Margin="2" Grid.Row="12" VerticalAlignment="Stretch">
                            <wf:NumericUpDown DecimalPlaces="2" Maximum="999999999999999999999999999" x:Name="_VATPenaltyCharge"/>
                        </WindowsFormsHost>
                        <CheckBox Grid.Row="13" Name="_IsLitigation" Grid.Column="1" VerticalAlignment="Center" Margin="2">Compensable</CheckBox>
                        <CheckBox Grid.Row="14" Name="_RemitPenaltyCharge" Grid.Column="1" Margin="2" VerticalAlignment="Center">RemitPenaltyCharge</CheckBox>

                    </Grid>
                </GroupBox>
                <Grid Grid.Column="1" HorizontalAlignment="Stretch" Name="GridDetails" Width="Auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="300*" />
                        <RowDefinition Height="338.08*" />
                    </Grid.RowDefinitions>
                    <GroupBox Header="Charges" Height="Auto" Name="GroupBoxRecoveryCharges" TabIndex="0" VerticalAlignment="Stretch">
                        <Grid Height="Auto" Name="GridCharges" Width="Auto">
                            <my:DataGrid AutoGenerateColumns="False" Margin="2" Name="DataGridCharges" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="False" CanUserSortColumns="False" />
                        </Grid>
                    </GroupBox>
                    <GroupBox Header="Special Charges" Name="GroupBoxSpecialCharges" TabIndex="0" VerticalContentAlignment="Center" Grid.Row="1">
                        <Grid Height="Auto" Name="GridSpecialCharges" Width="Auto">
                            <my:DataGrid AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="False" CanUserSortColumns="False" Height="Auto" Name="DataGridSpecialCharges" Width="Auto" Margin="2" />
                        </Grid>
                    </GroupBox>
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="Status" Name="TabItemClient_Status">
            <GroupBox Header="Client Status" Height="Auto" Name="GroupClientStatus" TabIndex="0" Width="Auto">
                <Grid Height="Auto" Name="GridClientStatus" Width="Auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="540*" />
                        <RowDefinition Height="Auto" MinHeight="28" />
                    </Grid.RowDefinitions>
                    <my:DataGrid AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="False" CanUserSortColumns="False" Margin="2" Name="DataGridClientStatus" SelectionMode="Extended" SelectionUnit="FullRow" />
                    <Button HorizontalAlignment="Right" Margin="0,2,2,0" Name="ButtonReset" Style="{DynamicResource ButtonStyle}" Width="67" Grid.Row="1" Height="Auto" VerticalAlignment="Top">OK</Button>
                </Grid>
            </GroupBox>
        </TabItem>
        <TabItem Header="Document" Name="TabItemDocument">
            <GroupBox Header="Reminder Document" Height="Auto" Name="GroupDoument" TabIndex="0" Width="Auto">
                <doc:DocumentEditor Nam
Didier
A: 

Another part in the end of the body

        <TabItem Header="Document" Name="TabItemDocument">
            <GroupBox Header="Reminder Document" Height="Auto" Name="GroupDoument" TabIndex="0" Width="Auto">
                <doc:DocumentEditor Name="Document"></doc:DocumentEditor>
            </GroupBox>
        </TabItem>
    </TabControl>
</DockPanel>
Didier
A: 

And here's the header part I've troncate the beginning of the Window markup

Window x:Class="NamaSpace.Presentation.Views.Client.CreateClient_ServiceTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:odc="clr-namespace:Odyssey.Controls;assembly=Odyssey" xmlns:doc="clr-namespace:WPFControls.DocumentManager;assembly=WPFControls" xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" Title="CreateClient_ServiceTest" Height="742" Width="926">

Didier