public bool isNotEmpty(texBoxWithErrorProvider tb) // Sprawdza czy textbox nie jest  pusty
 {
     if (tb.Text.Trim() == "")
     {
         tb.SetError(tb.Text);
         return(false);
     }
     return(true);
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\MainWindow.xaml"
                ((Lab1.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.MainWindow_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.stackPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:
                this.textBoxName = ((Lab1.texBoxWithErrorProvider)(target));
                return;

            case 4:
                this.textBoxSurname = ((Lab1.texBoxWithErrorProvider)(target));
                return;

            case 5:
                this.sliderAge = ((Lab1.sliderWithValue)(target));
                return;

            case 6:
                this.sliderWeight = ((Lab1.sliderWithValue)(target));
                return;

            case 7:
                this.buttonAdd = ((System.Windows.Controls.Button)(target));

            #line 24 "..\..\MainWindow.xaml"
                this.buttonAdd.Click += new System.Windows.RoutedEventHandler(this.ButtonAdd_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.buttonDelete = ((System.Windows.Controls.Button)(target));

            #line 30 "..\..\MainWindow.xaml"
                this.buttonDelete.Click += new System.Windows.RoutedEventHandler(this.buttonDelete_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.buttonChange = ((System.Windows.Controls.Button)(target));

            #line 31 "..\..\MainWindow.xaml"
                this.buttonChange.Click += new System.Windows.RoutedEventHandler(this.buttonChange_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.listBox = ((System.Windows.Controls.ListBox)(target));

            #line 35 "..\..\MainWindow.xaml"
                this.listBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listBoxSelectionChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }