<local:AdministrationWindow
        x:Class="Elwig.Windows.MemberAdminWindow"
        AutomationProperties.AutomationId="MemberAdminWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Elwig.Windows"
        xmlns:vm="clr-namespace:Elwig.ViewModels"
        Title="Mitglieder - Elwig" Height="700" Width="1250" MinHeight="650" MinWidth="1150"
        Loaded="Window_Loaded">
    <Window.DataContext>
        <vm:MemberAdminViewModel/>
    </Window.DataContext>
    <Window.Resources>
        <Style TargetType="Label">
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Padding" Value="2,4,2,4"/>
            <Setter Property="Height" Value="25"/>
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="2"/>
            <Setter Property="Height" Value="25"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="Height" Value="25"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="9,3"/>
            <Setter Property="Height" Value="27"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="19"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="24"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" MinWidth="300"/>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition Width="2.5*" MinWidth="800"/>
        </Grid.ColumnDefinitions>

        <Menu Grid.ColumnSpan="3" BorderThickness="0,0,0,1" BorderBrush="LightGray" Background="White">
            <MenuItem Header="Kontaktieren">
                <MenuItem x:Name="Menu_Contact_Email" Header="E-Mail senden..." IsEnabled="{Binding MemberHasEmail}"
                          Click="Menu_Contact_Email_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE715;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_Contact_Letterhead" Header="Briefkopf drucken" IsEnabled="{Binding IsMemberSelected}"
                          Click="Menu_Contact_Letterhead_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE749;"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="Stammdatenblatt">
                <MenuItem x:Name="Menu_MemberDataSheet_Show" Header="...anzeigen (PDF)" IsEnabled="{Binding IsMemberSelected}"
                          Click="Menu_MemberDataSheet_Show_Click" InputGestureText="Strg+P">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE8FF;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_MemberDataSheet_SavePdf" Header="...speichern... (PDF)" IsEnabled="{Binding IsMemberSelected}"
                          Click="Menu_MemberDataSheet_SavePdf_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xEA90;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_MemberDataSheet_Print" Header="...drucken" IsEnabled="{Binding IsMemberSelected}"
                          Click="Menu_MemberDataSheet_Print_Click" InputGestureText="Strg+Shift+P">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE749;"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem x:Name="Menu_MemberDataSheet_Email" Header="...per E-Mail schicken" IsEnabled="{Binding MemberCanSendEmail}"
                          Click="Menu_MemberDataSheet_Email_Click">
                    <MenuItem.Icon>
                        <TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text="&#xE89C;"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="Anlieferungsbestätigung" x:Name="Menu_DeliveryConfirmation">
                <MenuItem x:Name="Menu_DeliveryConfirmation_Show" Header="...anzeigen (PDF)" IsEnabled="False"
                          Click="Menu_DeliveryConfirmation_Show_Click"/>
                <MenuItem x:Name="Menu_DeliveryConfirmation_SavePdf" Header="...speichern... (PDF)" IsEnabled="False"
                          Click="Menu_DeliveryConfirmation_SavePdf_Click"/>
                <MenuItem x:Name="Menu_DeliveryConfirmation_Print" Header="...drucken" IsEnabled="False"
                          Click="Menu_DeliveryConfirmation_Print_Click"/>
                <MenuItem x:Name="Menu_DeliveryConfirmation_Email" Header="...per E-Mail schicken" IsEnabled="False"
                          Click="Menu_DeliveryConfirmation_Email_Click"/>
            </MenuItem>
            <MenuItem Header="Traubengutschrift" x:Name="Menu_CreditNote">
                <MenuItem x:Name="Menu_CreditNote_Show" Header="...anzeigen (PDF)" IsEnabled="False"
                          Click="Menu_CreditNote_Show_Click"/>
                <MenuItem x:Name="Menu_CreditNote_SavePdf" Header="...speichern... (PDF)" IsEnabled="False"
                          Click="Menu_CreditNote_SavePdf_Click"/>
                <MenuItem x:Name="Menu_CreditNote_Print" Header="...drucken" IsEnabled="False"
                          Click="Menu_CreditNote_Print_Click"/>
                <MenuItem x:Name="Menu_CreditNote_Email" Header="...per E-Mail schicken" IsEnabled="False"
                          Click="Menu_CreditNote_Email_Click"/>
            </MenuItem>
            <MenuItem Header="Mitgliederliste" x:Name="Menu_List">
                <MenuItem x:Name="Menu_List_SaveActive" Header="...mit Aktiven speichern (Excel)"
                          Click="Menu_List_SaveActive_Click" InputGestureText="Strg+L"/>
                <MenuItem x:Name="Menu_List_ShowActive" Header="...mit Aktiven anzeigen (PDF)"
                          Click="Menu_List_ShowActive_Click" InputGestureText="Strg+O"/>
                <MenuItem x:Name="Menu_List_SavePdfActive" Header="...mit Aktiven speichern... (PDF)"
                          Click="Menu_List_SavePdfActive_Click"/>
                <MenuItem x:Name="Menu_List_PrintActive" Header="...mit Aktiven drucken"
                          Click="Menu_List_PrintActive_Click" InputGestureText="Strg+Shift+O"/>
                <Separator/>
                <MenuItem x:Name="Menu_List_SaveFilters" Header="...aus Filtern speichern (Excel)"
                          Click="Menu_List_SaveFilters_Click"/>
                <MenuItem x:Name="Menu_List_ShowFilters" Header="...aus Filtern anzeigen (PDF)"
                          Click="Menu_List_ShowFilters_Click"/>
                <MenuItem x:Name="Menu_List_SavePdfFilters" Header="...aus Filtern speichern... (PDF)"
                          Click="Menu_List_SavePdfFilters_Click"/>
                <MenuItem x:Name="Menu_List_PrintFilters" Header="...aus Filtern drucken"
                          Click="Menu_List_PrintFilters_Click"/>
                <Separator/>
                <MenuItem x:Name="Menu_List_SaveAll" Header="...mit allen speichern (Excel)"
                          Click="Menu_List_SaveAll_Click"/>
                <MenuItem x:Name="Menu_List_ShowAll" Header="...mit allen anzeigen (PDF)"
                          Click="Menu_List_ShowAll_Click"/>
                <MenuItem x:Name="Menu_List_SavePdfAll" Header="...mit allen speichern... (PDF)"
                          Click="Menu_List_SavePdfAll_Click"/>
                <MenuItem x:Name="Menu_List_PrintAll" Header="...mit allen drucken"
                          Click="Menu_List_PrintAll_Click"/>
                <Separator/>
                <MenuItem x:Name="Menu_List_OrderMgNr" Header="...nach MgNr. sortieren"
                          IsCheckable="True" IsChecked="{Binding MemberListOrderByMgNr, Mode=TwoWay}"
                          Click="Menu_List_Order_Click"/>
                <MenuItem x:Name="Menu_List_OrderName" Header="...nach Nachname, Vorname sortieren"
                          IsCheckable="True" IsChecked="{Binding MemberListOrderByName, Mode=TwoWay}"
                          Click="Menu_List_Order_Click"/>
                <MenuItem x:Name="Menu_List_OrderOrt" Header="...nach Stamm-KG, Name sortieren"
                          IsCheckable="True" IsChecked="{Binding MemberListOrderByOrt, Mode=TwoWay}"
                          Click="Menu_List_Order_Click"/>
            </MenuItem>
            <MenuItem Header="Export">
                <MenuItem x:Name="Menu_Export_ExportSelected" Header="...von ausgewähltem Mitglied speichern..." IsEnabled="False"
                          Click="Menu_Export_ExportSelected_Click"/>
                <MenuItem x:Name="Menu_Export_UploadSelected" Header="...von ausgewähltem Mitglied hochladen" IsEnabled="False"
                          Click="Menu_Export_UploadSelected_Click"/>
                <Separator/>
                <MenuItem x:Name="Menu_Export_ExportFilters" Header="...aus Filtern speichern..."
                          Click="Menu_Export_ExportFilters_Click"/>
                <MenuItem x:Name="Menu_Export_UploadFilters" Header="...aus Filtern hochladen"
                          Click="Menu_Export_UploadFilters_Click"/>
                <Separator/>
                <MenuItem x:Name="Menu_Export_ExportAll" Header="...von allen Mitgliedern speichern..."
                          Click="Menu_Export_ExportAll_Click"/>
                <MenuItem x:Name="Menu_Export_UploadAll" Header="...von allen Mitgliedern hochladen"
                          Click="Menu_Export_UploadAll_Click"/>
            </MenuItem>
            <MenuItem Header="Kontakte">
                <MenuItem x:Name="Menu_Contacts_Selected" Header="...von ausgewähltem Mitglied speichern..." IsEnabled="False"
                          Click="Menu_Contacts_Selected_Click"/>
                <MenuItem x:Name="Menu_Contacts_Filters" Header="...aus Filtern speichern..."
                          Click="Menu_Contacts_Filters_Click"/>
                <MenuItem x:Name="Menu_Contacts_All" Header="...von allen Mitgliedern speichern..."
                          Click="Menu_Contacts_All_Click"/>
            </MenuItem>
        </Menu>

        <Grid Grid.Row="1" Margin="5,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="35"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="42"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBox x:Name="SearchInput" Text="{Binding SearchQuery, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding EnableSearchInputs}"
                     Grid.ColumnSpan="3" Margin="5,5,140,0"
                     TextChanged="SearchInput_TextChanged">
                <TextBox.ToolTip>
                    <TextBlock>
                        <Bold>Strg+F</Bold><LineBreak/><LineBreak/>
                        Mitglieder filtern und durchsuchen. Die Filter sind beliebig kombinierbar.<LineBreak/>
                        Groß- und Kleinschreibung ist in den meisten Fällen egal.<LineBreak/>
                        <LineBreak/>
                        Filtern nach:<LineBreak/>
                        <Bold>MgNr.</Bold>: z.B. 1234, 89, ...<LineBreak/>
                        <Bold>Vor-/Nachname</Bold>: z.B. Max Mustermann... <LineBreak/>
                        <Bold>Stamm-Zweigstelle</Bold>: z.B. zwst:Matzen, zwst:wolkersdorf, ...<LineBreak/>
                        <Bold>Stammgemeinde</Bold>: z.B. matzen, Wolkersdorf, ...<LineBreak/>
                        <Bold>UID</Bold>: z.B. ATU12345678, ...<LineBreak/>
                        <Bold>Betriebs-Nr.</Bold>: z.B. 0123456, ...<LineBreak/>
                        <Bold>Aktiv</Bold>: aktiv, !Aktiv (nicht-aktiv)<LineBreak/>
                        <Bold>Bio-Betrieb</Bold>: BIO, !bio (ausgenommen Bio)<LineBreak/>
                        <Bold>Buchführend</Bold>: buchf[ührend], Pauschal[iert], !buchf[ührend]<LineBreak/>
                        <Bold>Volllieferant</Bold>: voll[lieferant], !Voll[lieferant] (nicht-Volllieferant)<LineBreak/>
                        <Bold>Funktionär</Bold>: Funkt[ionär], !funkt[ionär] (nicht-Funktionär)<LineBreak/>
                        <Bold>Telefon-Nr.</Bold>: z.B. +436641234, ....<LineBreak/>
                        <Bold>Kontaktdaten</Bold>: email (mind. 1 E-Mail-Adr.), telnr (mind. 1 Tel.-Nr.), !email (keine E-Mail-Adr.), !telnr (keine Tel.-Nr.)<LineBreak/>
                        <Bold>Kontaktart</Bold>: kontakt:email, kontakt:post, !kontakt:email, !kontakt:post<LineBreak/>
                        <Bold>Flächenbindungen</Bold>: z.B. zw, GVK, WRB, Fläch[enbindung], !GVK, ... (Mitglieder mit aktiven Flächenbindungen)<LineBreak/>
                        <Bold>Freitext</Bold>: z.B. Rechnungsaddresse, Anmerkung, "matzen" (sucht nach dem Text "matzen")
                    </TextBlock>
                </TextBox.ToolTip>
            </TextBox>
            <CheckBox x:Name="ActiveMemberInput" Content="Nur aktive anzeigen"
                      IsChecked="{Binding ShowOnlyActiveMembers, Mode=TwoWay}" IsEnabled="{Binding EnableSearchInputs}"
                      Checked="ActiveMemberInput_Changed" Unchecked="ActiveMemberInput_Changed"
                      HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"/>
            <DataGrid x:Name="MemberList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
                      ItemsSource="{Binding Members, Mode=TwoWay}" SelectedItem="{Binding SelectedMember, Mode=TwoWay}"
                      CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False"
                      SelectionChanged="MemberList_SelectionChanged"
                      Margin="5,0,5,0" Grid.Row="1" FontSize="14" Grid.ColumnSpan="3">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="MgNr." Binding="{Binding MgNr, StringFormat='{}{0} '}" Width="50">
                        <DataGridTextColumn.CellStyle>
                            <Style>
                                <Setter Property="TextBlock.TextAlignment" Value="Right"/>
                            </Style>
                        </DataGridTextColumn.CellStyle>
                    </DataGridTextColumn>
                    <DataGridTextColumn Header="Nachname" Binding="{Binding Name}" Width="140"/>
                    <DataGridTextColumn Header="Vorname" Binding="{Binding GivenName}" Width="140"/>
                    <DataGridTextColumn Header="GA" Binding="{Binding BusinessShares, StringFormat='{}{0} '}" Width="40">
                        <DataGridTextColumn.CellStyle>
                            <Style>
                                <Setter Property="TextBlock.TextAlignment" Value="Right"/>
                            </Style>
                        </DataGridTextColumn.CellStyle>
                    </DataGridTextColumn>
                    <DataGridTextColumn Header="Rechnungsadresse" Binding="{Binding BillingAddress.FullName}" Width="200"/>
                </DataGrid.Columns>
            </DataGrid>

            <Button x:Name="NewMemberButton" Content="Neu" Visibility="{Binding ControlButtonsVisibility}"
                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,5,2.5,10" Grid.Column="0" Grid.Row="2"
                    Click="NewMemberButton_Click">
                <Button.ToolTip>
                    <TextBlock FontWeight="Bold">Alt+Einfg</TextBlock>
                </Button.ToolTip>
            </Button>
            <Button x:Name="EditMemberButton" Content="Bearbeiten" IsEnabled="False" Visibility="{Binding ControlButtonsVisibility}"
                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="2.5,5,2.5,10" Grid.Column="1" Grid.Row="2"
                    Click="EditMemberButton_Click">
                <Button.ToolTip>
                    <TextBlock FontWeight="Bold">Strg+B</TextBlock>
                </Button.ToolTip>
            </Button>
            <Button x:Name="DeleteMemberButton" Content="Löschen" IsEnabled="False" Visibility="{Binding ControlButtonsVisibility}"
                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="2.5,5,5,10" Grid.Column="2" Grid.Row="2"
                    Click="DeleteMemberButton_Click">
                <Button.ToolTip>
                    <TextBlock FontWeight="Bold">Alt+Entf</TextBlock>
                </Button.ToolTip>
            </Button>

            <Button x:Name="SaveButton" Content="Speichern" IsEnabled="False" Visibility="{Binding EditingButtonsVisibility}"
                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,5,2.5,10" Grid.Column="0" Grid.Row="2"
                    Click="SaveButton_Click">
                <Button.ToolTip>
                    <TextBlock FontWeight="Bold">Strg+S</TextBlock>
                </Button.ToolTip>
            </Button>
            <Button x:Name="ResetButton" Content="Zurücksetzen" IsEnabled="False" Visibility="{Binding EditingButtonsVisibility}"
                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="2.5,5,2.5,10" Grid.Column="1" Grid.Row="2"
                    Click="ResetButton_Click">
                <Button.ToolTip>
                    <TextBlock FontWeight="Bold">Strg+Z</TextBlock>
                </Button.ToolTip>
            </Button>
            <Button x:Name="CancelButton" Content="Abbrechen" IsEnabled="False" Visibility="{Binding EditingButtonsVisibility}" IsCancel="True"
                    HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="2.5,5,5,10" Grid.Column="2" Grid.Row="2"
                    Click="CancelButton_Click">
                <Button.ToolTip>
                    <TextBlock FontWeight="Bold">Esc</TextBlock>
                </Button.ToolTip>
            </Button>
        </Grid>

        <GridSplitter Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

        <Grid Grid.Column="2" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="108"/>
                <RowDefinition Height="120"/>
                <RowDefinition Height="18"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="113"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <GroupBox Header="Persönliche Daten" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Margin="5,5,5,5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="80"/>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>

                    <Label Content="MgNr.:" Margin="10,10,0,0" Grid.Column="0"/>
                    <TextBox x:Name="MgNrInput" Text="{Binding MgNrString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,0,0" Width="48" Grid.Column="1" TextAlignment="Right" HorizontalAlignment="Left"
                             TextChanged="MgNrInput_TextChanged" LostFocus="MgNrInput_LostFocus"/>
                    <CheckBox x:Name="JuridicalPersonInput" Content="Juristische Person" IsChecked="{Binding IsJuridicalPerson}"
                              Checked="JuridicalPersonInput_Changed" Unchecked="JuridicalPersonInput_Changed"
                              Margin="53,15,0,0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top"/>

                    <Label Content="Vorg.:" Margin="10,10,0,0" Grid.Column="2"/>
                    <TextBox x:Name="PredecessorMgNrInput" Text="{Binding PredecessorMgNrString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,10,0" Width="48" Grid.Column="3" TextAlignment="Right" HorizontalAlignment="Left"
                             TextChanged="PredecessorMgNrInput_TextChanged" LostFocus="PredecessorMgNrInput_LostFocus"/>
                    <Button x:Name="MemberReferenceButton" Grid.Column="3" Height="25" Width="25" FontFamily="Segoe MDL2 Assets" Content="&#xEE35;" Padding="0,0,0,0"
                            Margin="53,10,10,10" VerticalAlignment="Top" HorizontalAlignment="Left" IsEnabled="{Binding EnableMemberReferenceButton}" ToolTip="Zu Vorgänger springen"
                            Click="MemberReferenceButton_Click"/>

                    <Label Content="Präfix:" Margin="10,40,0,0" Grid.Column="2" Visibility="{Binding PersonalNameVisibility}"/>
                    <TextBox x:Name="PrefixInput" Text="{Binding Prefix, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding PersonalNameVisibility}"
                             Margin="0,40,10,0" Grid.Column="3"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="Name:" Margin="10,40,0,0" Grid.Column="0" Visibility="{Binding JuridicalNameVisibility}"/>
                    <Label Content="Vorname:" Margin="10,40,0,0" Grid.Column="0" Visibility="{Binding PersonalNameVisibility}"/>
                    <TextBox x:Name="GivenNameInput" Text="{Binding GivenName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding PersonalNameVisibility}"
                             Margin="0,40,0,0" Grid.Column="1"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="Nachname:" Margin="10,70,0,0" Grid.Column="0" Visibility="{Binding PersonalNameVisibility}"/>
                    <TextBox x:Name="NameInput" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,70,0,0" Grid.Column="1"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="Zu Handen:" Margin="10,70,0,0" Grid.Column="0" Visibility="{Binding JuridicalNameVisibility}"/>
                    <TextBox x:Name="AttnInput" Text="{Binding ForTheAttentionOf, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding JuridicalNameVisibility}"
                             Margin="0,70,10,0" Grid.Column="1" Grid.ColumnSpan="3"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="Suffix:" Margin="10,70,0,0" Grid.Column="2" Visibility="{Binding PersonalNameVisibility}"/>
                    <TextBox x:Name="SuffixInput" Text="{Binding Suffix, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding PersonalNameVisibility}"
                             Margin="0,70,10,0" Grid.Column="3"
                             TextChanged="TextBox_TextChanged"/>

                    <Label x:Name="BirthdayLabel" Content="Geburtstag:" Margin="10,100,0,0" Grid.Column="0"/>
                    <TextBox x:Name="BirthdayInput" Text="{Binding Birthday, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,100,0,0" Grid.Column="1" Width="78" TextAlignment="Right" HorizontalAlignment="Left"
                             TextChanged="PartialDateInput_TextChanged" LostFocus="PartialDateInput_LostFocus"/>

                    <Label Content="Alter:" Margin="85,100,0,0" Grid.Column="1" Grid.ColumnSpan="3"/>
                    <TextBlock x:Name="Age" Text="{Binding Age, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                               Margin="119,104,0,0" Grid.Column="1" Grid.ColumnSpan="3" TextWrapping="NoWrap" VerticalAlignment="Top"/>

                    <CheckBox x:Name="DeceasedInput" Content="Verstorben" IsChecked="{Binding IsDeceased, Mode=TwoWay}"
                              Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
                              Grid.Column="3" HorizontalAlignment="Left" Margin="0,105,0,0" VerticalAlignment="Top"/>

                    <Label Content="Adresse:" Margin="10,130,0,0"/>
                    <TextBox x:Name="AddressInput" Text="{Binding Address, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,130,10,0" Grid.Column="1" Grid.ColumnSpan="3"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="PLZ/Ort:" Margin="10,160,0,0" Grid.Column="0"/>
                    <TextBox x:Name="PlzInput" Margin="0,160,0,0" Text="{Binding PlzString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Width="42" Grid.Column="1" HorizontalAlignment="Left"
                             TextChanged="PlzInput_TextChanged" LostFocus="PlzInput_LostFocus" Tag="PLZ"/>
                    <ComboBox x:Name="OrtInput" SelectedItem="{Binding Ort, Mode=TwoWay}" ItemsSource="{Binding OrtSource, Mode=TwoWay}"
                              ItemTemplate="{StaticResource PostalDestTemplate}" TextSearch.TextPath="Ort.Name"
                              Margin="47,160,10,0" Grid.Column="1" Grid.ColumnSpan="3"/>
                </Grid>
            </GroupBox>
            <GroupBox Header="Kontaktdaten" Grid.Column="0" Grid.Row="2" Grid.RowSpan="2" Margin="5,5,5,5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="135"/>
                        <ColumnDefinition Width="*" MinWidth="180"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>

                    <Label x:Name="EmailAddress1Label" Content="E-Mail-Adresse:" Margin="10,10,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress1Input" Text="{Binding EmailAddresses[0], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress2Label" Content="E-Mail-Adresse:" Margin="10,40,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress2Input" Text="{Binding EmailAddresses[1], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,40,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress3Label" Content="E-Mail-Adresse:" Margin="10,70,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress3Input" Text="{Binding EmailAddresses[2], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,70,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress4Label" Content="E-Mail-Adresse:" Margin="10,100,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress4Input" Text="{Binding EmailAddresses[3], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,100,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress5Label" Content="E-Mail-Adresse:" Margin="10,130,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress5Input" Text="{Binding EmailAddresses[4], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,130,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress6Label" Content="E-Mail-Adresse:" Margin="10,160,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress6Input" Text="{Binding EmailAddresses[5], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,160,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress7Label" Content="E-Mail-Adresse:" Margin="10,190,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress7Input" Text="{Binding EmailAddresses[6], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,190,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress8Label" Content="E-Mail-Adresse:" Margin="10,220,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress8Input" Text="{Binding EmailAddresses[7], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,220,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <Label x:Name="EmailAddress9Label" Content="E-Mail-Adresse:" Margin="10,250,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EmailAddress9Input" Text="{Binding EmailAddresses[8], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,250,10,0" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="EmailAddressInput_TextChanged" LostFocus="EmailAddressInput_LostFocus"/>

                    <ComboBox x:Name="PhoneNr1TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[0].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,70,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr1Input" Text="{Binding PhoneNrs[0].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,70,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr1CommentInput" Text="{Binding PhoneNrs[0].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,70,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr2TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[1].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,100,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr2Input" Text="{Binding PhoneNrs[1].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,100,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr2CommentInput" Text="{Binding PhoneNrs[1].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,100,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr3TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[2].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,130,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr3Input" Text="{Binding PhoneNrs[2].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,130,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr3CommentInput" Text="{Binding PhoneNrs[2].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,130,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr4TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[3].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,160,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr4Input" Text="{Binding PhoneNrs[3].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,160,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr4CommentInput" Text="{Binding PhoneNrs[3].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,160,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr5TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[4].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,190,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr5Input" Text="{Binding PhoneNrs[4].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,190,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr5CommentInput" Text="{Binding PhoneNrs[4].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,190,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr6TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[5].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,220,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr6Input" Text="{Binding PhoneNrs[5].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,220,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr6CommentInput" Text="{Binding PhoneNrs[5].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,220,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr7TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[6].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,250,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr7Input" Text="{Binding PhoneNrs[6].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,250,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr7CommentInput" Text="{Binding PhoneNrs[6].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,250,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr8TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[7].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,280,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr8Input" Text="{Binding PhoneNrs[7].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,280,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr8CommentInput" Text="{Binding PhoneNrs[7].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,280,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>

                    <ComboBox x:Name="PhoneNr9TypeInput" DisplayMemberPath="Value"
                              SelectedIndex="{Binding PhoneNrs[8].Type, Mode=TwoWay}" ItemsSource="{Binding PhoneNrTypes}"
                              Margin="6,310,5,0" FontSize="12" Padding="6,4,4,4"/>
                    <TextBox x:Name="PhoneNr9Input" Text="{Binding PhoneNrs[8].Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,310,5,0" Grid.Column="1"
                             TextChanged="PhoneNrInput_TextChanged" LostFocus="PhoneNrInput_LostFocus"/>
                    <TextBox x:Name="PhoneNr9CommentInput" Text="{Binding PhoneNrs[8].Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,280,10,0" Grid.Column="2"
                             TextChanged="TextBox_TextChanged"/>
                </Grid>
            </GroupBox>
            <GroupBox Header="Bankverbindung" Grid.Column="0" Grid.Row="4" Margin="5,5,5,10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="65"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Content="IBAN:" Margin="10,10,0,0" Grid.Column="0"/>
                    <TextBox x:Name="IbanInput" Text="{Binding Iban, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,10,0" Grid.Column="1" Width="290" HorizontalAlignment="Left"
                             TextChanged="IbanInput_TextChanged" LostFocus="IbanInput_LostFocus"/>

                    <Label Content="BIC:" Margin="10,40,0,0" Grid.Column="0"/>
                    <TextBox x:Name="BicInput" Text="{Binding Bic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,40,10,0" Grid.Column="1" Width="150" HorizontalAlignment="Left"
                             TextChanged="BicInput_TextChanged" LostFocus="BicInput_LostFocus"/>
                </Grid>
            </GroupBox>
            <GroupBox Header="Betrieb" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1" Margin="5,5,5,5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="90"/>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Content="UID:" Margin="10,10,0,0" Grid.Column="0"/>
                    <TextBox x:Name="UstIdNrInput" Text="{Binding UstIdNr, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,10,0" Grid.Column="1" Width="96" HorizontalAlignment="Left"
                             TextChanged="UstIdNrInput_TextChanged" LostFocus="UstIdNrInput_LostFocus"/>

                    <Label Content="Betriebs-Nr.:" Margin="10,40,0,0" Grid.Column="0"/>
                    <TextBox x:Name="LfbisNrInput" Text="{Binding LfbisNr, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,40,10,0" Grid.Column="1" Width="64" HorizontalAlignment="Left" TextAlignment="Right"
                             TextChanged="LfbisNrInput_TextChanged" LostFocus="LfbisNrInput_LostFocus"/>

                    <CheckBox x:Name="BuchführendInput" Content="Buchführend" IsChecked="{Binding IsBuchführend, Mode=TwoWay}" IsEnabled="False"
                              Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
                              Grid.Column="2" HorizontalAlignment="Left" Margin="10,15,0,0" VerticalAlignment="Top"/>

                    <CheckBox x:Name="OrganicInput" Content="Bio" IsChecked="{Binding IsOrganic, Mode=TwoWay}" IsEnabled="False"
                              Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
                              Grid.Column="2" HorizontalAlignment="Left" Margin="10,45,0,0" VerticalAlignment="Top"/>
                    <Button x:Name="OrganicButton" Content="easy-cert.com" IsEnabled="{Binding IsMemberSelected}"
                            Height="25" FontSize="12"
                            Click="OrganicButton_Click"
                            Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="60,40,0,0"/>
                </Grid>
            </GroupBox>
            <GroupBox Header="Rechnungsadresse (optional)" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Margin="5,5,5,5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="65"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Content="Name:" Margin="10,10,0,0" Grid.Column="0"/>
                    <TextBox x:Name="BillingNameInput" Text="{Binding BillingName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,10,10" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="Adresse:" Margin="10,40,0,0" Grid.Column="0"/>
                    <TextBox x:Name="BillingAddressInput" Text="{Binding BillingAddress, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,40,10,0" Grid.Column="1"
                             TextChanged="TextBox_TextChanged"/>

                    <Label Content="PLZ/Ort:" Margin="10,70,0,0" Grid.Column="0"/>
                    <TextBox x:Name="BillingPlzInput" Text="{Binding BillingPlzString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,70,0,0" Width="42" Grid.Column="1" HorizontalAlignment="Left"
                             TextChanged="PlzInput_TextChanged" LostFocus="PlzInput_LostFocus" Tag="PLZ"/>
                    <ComboBox x:Name="BillingOrtInput" SelectedItem="{Binding BillingOrt, Mode=TwoWay}" ItemsSource="{Binding BillingOrtSource, Mode=TwoWay}"
                              ItemTemplate="{StaticResource PostalDestTemplate}" TextSearch.TextPath="Ort.Name"
                              Margin="47,70,10,0" Grid.Column="1"/>
                </Grid>
            </GroupBox>
            <GroupBox Header="Genossenschaft" Grid.Column="1" Grid.Row="3" Grid.RowSpan="2" Margin="5,5,5,10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="120"/>
                        <ColumnDefinition Width="120"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Content="Eintritt:" Margin="10,10,0,0" Grid.Column="0"/>
                    <TextBox x:Name="EntryDateInput" Text="{Binding EntryDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,10,10,0" Width="78" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
                             TextChanged="DateInput_TextChanged" LostFocus="DateInput_LostFocus"/>

                    <Label Content="Austritt:" Margin="10,40,0,0" Grid.Column="0"/>
                    <TextBox x:Name="ExitDateInput" Text="{Binding ExitDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,40,10,0" Width="78" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
                             TextChanged="DateInput_TextChanged" LostFocus="DateInput_LostFocus"/>

                    <Label Content="Geschäftsanteile:" Margin="10,70,0,0" Grid.Column="0"/>
                    <TextBox x:Name="BusinessSharesInput" Text="{Binding BusinessSharesString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,70,10,0" Width="48" Grid.Column="1" HorizontalAlignment="Left" TextAlignment="Right"
                             TextChanged="IntegerInput_TextChanged"/>

                    <Label Content="BH-Konto:" Margin="10,100,0,0" Grid.Column="0"/>
                    <TextBox x:Name="AccountingNrInput" Text="{Binding AccountingNr, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,100,10,0" Grid.Column="1"
                             TextChanged="TextBox_TextChanged"/>

                    <CheckBox x:Name="ActiveInput" Content="Aktiv" IsChecked="{Binding IsActive, Mode=TwoWay}" IsEnabled="False"
                              Checked="ActiveInput_Changed" Unchecked="ActiveInput_Changed"
                              Grid.Column="2" HorizontalAlignment="Left" Margin="10,15,0,0" VerticalAlignment="Top"/>

                    <CheckBox x:Name="VollLieferantInput" Content="Volllieferant" IsChecked="{Binding IsVollLieferant, Mode=TwoWay}" IsEnabled="False"
                              Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
                              Grid.Column="2" HorizontalAlignment="Left" Margin="10,45,0,0" VerticalAlignment="Top"/>

                    <CheckBox x:Name="FunkionärInput" Content="Funktionär" IsChecked="{Binding IsFunktionär, Mode=TwoWay}" IsEnabled="False"
                              Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
                              Grid.Column="2" HorizontalAlignment="Left" Margin="10,75,0,0" VerticalAlignment="Top"/>

                    <Label Content="Stamm-Zwst.:" Margin="10,130,0,0" Grid.Column="0"/>
                    <ComboBox x:Name="BranchInput" SelectedItem="{Binding Branch, Mode=TwoWay}" ItemsSource="{Binding BranchSource, Mode=TwoWay}"
                              DisplayMemberPath="Name" TextSearch.TextPath="Name"
                              Margin="0,130,10,0" Grid.Column="1" Grid.ColumnSpan="2"/>

                    <Label Content="Stammgemeinde:" Margin="10,160,0,0" Grid.Column="0"/>
                    <ComboBox x:Name="DefaultKgInput" SelectedItem="{Binding DefaultKg, Mode=TwoWay}" ItemsSource="{Binding DefaultKgSource, Mode=TwoWay}"
                              DisplayMemberPath="Name" TextSearch.TextPath="Name"
                              Margin="0,160,40,10" Grid.Column="1" Grid.ColumnSpan="2"/>
                    <Button x:Name="KgDetailsButton" Content="&#xE712;" FontFamily="Segoe MDL2 Assets" FontSize="14" Padding="0,1,0,0"
                            Click="KgDetailsButton_Click"
                            Grid.Column="2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="25" Height="25" Margin="10,160,10,10"/>

                    <Label Content="Anmerkung:" Margin="10,190,0,0" Grid.Column="0"/>
                    <TextBox x:Name="CommentInput" Text="{Binding Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,190,10,70" Grid.Column="1" Grid.ColumnSpan="2"
                             TextChanged="TextBox_TextChanged"
                             VerticalAlignment="Stretch" Height="auto" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible"/>

                    <Label Content="Kontaktart:" Margin="10,10,0,40" Grid.Column="0" VerticalAlignment="Bottom"/>
                    <CheckBox x:Name="ContactPostalInput" Content="Post" IsChecked="{Binding ContactViaPost, Mode=TwoWay}" IsEnabled="False"
                              Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
                              HorizontalAlignment="Left" Margin="0,0,0,45" VerticalAlignment="Bottom" Grid.Column="1" Grid.ColumnSpan="2"/>
                    <CheckBox x:Name="ContactEmailInput" Content="E-Mail" IsChecked="{Binding ContactViaEmail, Mode=TwoWay}" IsEnabled="False"
                              Checked="ContactEmailInput_Changed" Unchecked="ContactEmailInput_Changed"
                              HorizontalAlignment="Left" Margin="60,0,0,45" VerticalAlignment="Bottom" Grid.Column="1" Grid.ColumnSpan="2"/>

                    <Label Content="Zuletzt geändert:" Margin="10,10,0,10" Grid.Column="0" VerticalAlignment="Bottom"/>
                    <TextBlock x:Name="LastModified" Text="{Binding ModifiedAtShort}"
                               Margin="0,10,0,15" Grid.Column="1" TextWrapping="NoWrap" VerticalAlignment="Bottom">
                        <TextBlock.ToolTip>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="200"/>
                                    <ColumnDefinition Width="110"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <TextBlock Grid.Row="0" Grid.Column="0" Text="Erstellt:"/>
                                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding CreatedAt}"/>
                                <TextBlock Grid.Row="1" Grid.Column="0" Text="Zuletzt geändert:"/>
                                <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ModifiedAt}"/>
                                <TextBlock Grid.Row="2" Grid.Column="0" Text="Zuletzt von diesem Gerät exportiert:"/>
                                <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding ExportedAt}"/>
                                <TextBlock Grid.Row="3" Grid.Column="0" Text="Zuletzt auf dieses Gerät importiert:"/>
                                <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding ImportedAt}"/>
                            </Grid>
                        </TextBlock.ToolTip>
                    </TextBlock>

                    <Button x:Name="DeliveryButton" Content="Lieferungen" IsEnabled="{Binding IsMemberSelected}"
                            Click="DeliveryButton_Click"
                            HorizontalAlignment="Right" Margin="10,00,10,37" Width="150" VerticalAlignment="Bottom" Grid.ColumnSpan="3"/>
                    <Button x:Name="AreaCommitmentButton" Content="Flächenbindungen" IsEnabled="{Binding IsMemberSelected}"
                            Click="AreaCommitmentButton_Click"
                            HorizontalAlignment="Right" Margin="10,10,10,5" Width="150" VerticalAlignment="Bottom" Grid.ColumnSpan="3"/>
                </Grid>
            </GroupBox>
        </Grid>

        <StatusBar Grid.Row="2" Grid.ColumnSpan="3" BorderThickness="0,1,0,0" BorderBrush="Gray">
            <StatusBar.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="150"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="200"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="1*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="1*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="1*"/>
                        </Grid.ColumnDefinitions>
                    </Grid>
                </ItemsPanelTemplate>
            </StatusBar.ItemsPanel>
            <StatusBarItem>
                <TextBlock ToolTip="{Binding StatusMembersToolTip}">
                    Mitglieder: <Run Text="{Binding StatusMembers}"/>
                </TextBlock>
            </StatusBarItem>
            <Separator Grid.Column="1"/>
            <StatusBarItem Grid.Column="2">
                <TextBlock ToolTip="{Binding StatusBusinessSharesToolTip}">
                    Geschäftsanteile: <Run Text="{Binding StatusBusinessShares}"/>
                </TextBlock>
            </StatusBarItem>
            <Separator Grid.Column="3"/>
            <StatusBarItem Grid.Column="4">
                <TextBlock ToolTip="{Binding StatusAreaCommitmentToolTip}">
                    Gebundene Fläche (<Run Text="{Binding StatusAreaCommitmentInfo}"/>): <Run Text="{Binding StatusAreaCommitment}"/>
                </TextBlock>
            </StatusBarItem>
            <Separator Grid.Column="5"/>
            <StatusBarItem Grid.Column="6">
                <TextBlock ToolTip="{Binding StatusDeliveriesThisSeasonToolTip}">
                    Lieferungen (<Run Text="{Binding StatusDeliveriesThisSeasonInfo}"/>): <Run Text="{Binding StatusDeliveriesThisSeason}"/>
                </TextBlock>
            </StatusBarItem>
            <Separator Grid.Column="7"/>
            <StatusBarItem Grid.Column="8">
                <TextBlock ToolTip="{Binding StatusDeliveriesLastSeasonToolTip}">
                    Lieferungen (<Run Text="{Binding StatusDeliveriesLastSeasonInfo}"/>): <Run Text="{Binding StatusDeliveriesLastSeason}"/>
                </TextBlock>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</local:AdministrationWindow>
