Q:

a combobox creates and opens a Datepicker element and the selected date is automatically entered into the textbox value in front

This design is inside the transaction page!  if the user wants to search a transaction by its date, clicks the 'by date' Combobox, then appears a datepicker element, the user chooses/picks a date from the datepicker then the chosen date appears as string into the textbox. 
I've a combobox with following elements into it. 
<ComboBox Width="105" 
          SelectedIndex="0">
     <ComboBoxItem Name="TrSearchByName"
                   Content="by First Name"/>
     <ComboBoxItem Name="TrSearchByLastName"
                   Content="by Last Name"/>
     <ComboBoxItem Name="TrSearchByAmount"
                   Content="by Amount"/>
     <ComboBoxItem Name="TrSearchByDate"
                   Content="by Date"
                   Selected="PickDateUp"/>
</ComboBox>

and one Textbox element (ByDate) in front of it.  If the Combobox (By Date) is selected, a datepicker elements appears and the user picks a date up, then the selected date is the value of the Textbox element (ByDate) automatically.  The event handler C# code is:
private void PickDateUp(object sender, RoutedEventArgs e)
   {
       DatePicker choose = new DatePicker();
      //here wanna work further! 
   }

please help!  

A:

Maybe it can help. 
MainWindow.cs
using System;
using System. Windows;
using System. Windows. Controls;

namespace Test
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public string SearchValue { get; set; }
        public SearchParameter SelectedParameter { get; set; }

        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
        }

        private void DoSearch(object sender, RoutedEventArgs e)
        {
            if (string. IsNullOrEmpty(SearchValue) ||
                TrSearchBy. SelectedIndex < 0 ||
                TrSearchBy. SelectedIndex > TrSearchBy. Items. Count -1)
                return;

            if (SelectedParameter. Value == "Date")
            {
                //Search by date
                DateTime date = DateTime. Parse(SearchValue);
            }
            else
            {
                //Search by others
            }
        }
    }

    public class SearchParameter
    {
        public string Value { get; set; }

        public Control Content { get; set; }
    }
}

MainWindow.xaml
<Window x:Class="Test. MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:Test" 
    mc:Ignorable="d"
    Title="MainWindow" Height="186" Width="345">
<StackPanel>
    <StackPanel. Resources>
        <TextBox x:Key="TextBoxValue" Text="{Binding SearchValue, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"/>
        <DatePicker x:Key="DatePickerValue" Text="{Binding SearchValue, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"/>

        <DataTemplate x:Key="ValuePresenter">
            <TextBlock Text="{Binding Value}"/>
        </DataTemplate>

        <x:Array x:Key="SearchParameters" Type="{x:Type local:SearchParameter}">
            <local:SearchParameter Value="First name" Content="{StaticResource TextBoxValue}"/>
            <local:SearchParameter Value="Last name" Content="{StaticResource TextBoxValue}"/>
            <local:SearchParameter Value="Amount" Content="{StaticResource TextBoxValue}"/>
            <local:SearchParameter Value="Date" Content="{StaticResource DatePickerValue}"/>
        </x:Array>
    </StackPanel. Resources>

    <TextBlock Text="Search By"/>
    <ComboBox Name="TrSearchBy" SelectedIndex="0"
              SelectedItem="{Binding SelectedParameter, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
              ItemsSource="{DynamicResource SearchParameters}" ItemTemplate="{StaticResource ValuePresenter}"/>

    <TextBlock Text="{Binding SelectedItem. Value, ElementName=TrSearchBy}" />
    <ContentControl Content="{Binding SelectedItem. Content, ElementName=TrSearchBy}" />
    <Button Content="Search" Click="DoSearch" />
</StackPanel>

