nitish.mohiputlall -4 Junior Poster in Training

here what i have acheive till now

xaml

<Hub x:Name="EventName" Header="Event Name"  Foreground="White" >
        <HubSection  x:Name="HubSection0" x:Uid="first" >

            <DataTemplate>
                <Grid>
                    <ScrollViewer  >
                        <StackPanel   Orientation="Vertical">
                            <Image HorizontalAlignment="Left" Height="100" Margin="10,10,10,20" VerticalAlignment="Top" Width="100" Source="ms-appx:///Assets/dummyuserimage.png"  x:Name="EventPhoto" x:Uid="E_pic"/>
                            <TextBlock Text="Date" FontSize="14.667" FontFamily="Segoe UI"/>
                            <TextBlock x:Name="txtDate"  FontSize="14.667" FontFamily="Segoe UI" Height="39" />
                            <TextBlock Text="Time" FontSize="14.667" FontFamily="Segoe UI"/>
                            <TextBlock x:Name="txtTime"  FontSize="14.667" FontFamily="Segoe UI" Height="39" />
                            <TextBlock Text="Location" FontSize="14.667" FontFamily="Segoe UI"/>
                            <TextBlock x:Name="txtLocation"  FontSize="14.667" FontFamily="Segoe UI" Height="39"  />
                            <TextBlock Text="Description" FontSize="14.667" FontFamily="Segoe UI"/>
                            <TextBlock x:Name="txtDescription"  FontSize="14.667" FontFamily="Segoe UI" Height="202" />
                       </StackPanel>
                    </ScrollViewer>
                </Grid>
            </DataTemplate>
        </HubSection>

xaml.cs:

private DependencyObject FindChildControl<T>(DependencyObject control, string ctrlName)
    {
        int childNumber = VisualTreeHelper.GetChildrenCount(control);
        for (int i = 0; i < childNumber; i++)
        {
            DependencyObject child = VisualTreeHelper.GetChild(control, i);
            FrameworkElement fe = child as FrameworkElement;
            // Not a framework element or is null
            if (fe == null) return null;

            if (child is T && fe.Name == ctrlName)
            {
                // Found the control so return
                return child;
            }
            else
            {
                // Not found it - search children
                DependencyObject nextLevel = FindChildControl<T>(child, ctrlName);
                if (nextLevel != null)
                    return nextLevel;
            }
        }
        return null;
    }

    private IDialogService _dialogService;
    protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
       var evnt = (Event)e.Parameter;
       DateTime dt;
       DateTime dt1;
       dt = evnt.StartingTime;
       dt1 = evnt.Date;

       TextBlock tb = FindChildControl<TextBlock>(HubSection0, "txtDate") as TextBlock;
       tb.Text = dt.ToString();
        if(true)
        {
            await _dialogService.ShowMessage("Group has been created", "Success!.");
        }
       TextBlock tb1 = FindChildControl<TextBlock>(HubSection0, "txtTime") as TextBlock;
       tb1.Text = dt1.ToString();
       TextBlock tb2 = FindChildControl<TextBlock>(HubSection0, "txtLocation") as TextBlock;
       tb2.Text = evnt.Location;
       TextBlock tb3 = FindChildControl<TextBlock>(HubSection0, "txtDescription") as TextBlock;
       tb3.Text = evnt.Desc;

    }

I am new to c# development, what i want to do is when i click on an event which on another page the user is navigated to the event page where all the details are displayed about the event but the problem here is that the data is being retrieved but is not placed into the textblock any help and quick if possible. Thanks. (the click event works only to display the data in the textblock does not work)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.