locked
how can i take datepicker's date to textblock RRS feed

  • General discussion

  • hi Team,

    i wanted to know that Is it possible to take data from xaml to xaml.

    actually i m making a report where my requirement is that i wanted to dates range(which are comes from two DatePickers) in report's label which is also presented in xaml side.

    means Both datePicker are also presented in xaml side and where Report label are also presented in xaml side.

    pls help me resolve this problem

    thanks in Advance

     

     

    Tuesday, October 4, 2011 6:26 AM

All replies

  • If I understand your requirement correctly here is my xaml

     <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Start Date : " VerticalAlignment="Center"/>
            <sdk:DatePicker  Width="130" Height="25" x:Name="dtpStartDate"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Row="1">
                <TextBlock Text="End Date : " VerticalAlignment="Center"/>
                <sdk:DatePicker  Width="130" Height="25" x:Name="dtpEndDate" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Row="2">
                <TextBlock Text="Output : " VerticalAlignment="Center"/>
                <TextBlock  VerticalAlignment="Center">
                    <Run Text="{Binding SelectedDate, ElementName=dtpStartDate,StringFormat='dd/MM/yyyy'}"/>
                    <Run Text=" And "/>
                    <Run Text="{Binding SelectedDate, ElementName=dtpEndDate,StringFormat='dd/MM/yyyy'}"/>
                </TextBlock>
            </StackPanel>
    </Grid>

    here I have bind the textblock with the start and end date.

    Hope that will help.

    let me know if you have any question

    Tuesday, October 4, 2011 6:35 AM
  • You can element bind the TextBlock with the DatePicker control.  If you want the date to render in a particular format, you can use XAML StringFormat or a IValueConverter converter.

    http://silverlight.bayprince.com/tutorials.php?tutorial=4

    Tuesday, October 4, 2011 10:25 AM
  • Hi Sir,

    Thanks to seen my post request,

    i m trying this code but this is not working in report.

     

    Friday, October 7, 2011 1:11 AM