We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to reference a contentControl (Frame)

Thread ID:

Created:

Updated:

Platform:

Replies:

127175 Oct 31,2016 08:34 PM UTC Nov 1,2016 12:02 PM UTC WPF 2
loading
Tags: DockingManager
Dwayne Etchison
Asked On October 31, 2016 08:34 PM UTC

I am creating a new tab and document (Frame) upon a button click. In order to prevent multiple of the same window I am trying to check and see if this window already exists by attempting to find it by name, however it can't seem to find it, although it is listed as a Child at runtime.

        private void NewWeighButton_Click(object sender, RoutedEventArgs e)
        {
            //Check if the window is already open, if it is focus it, if not create it.
            if (SyncDockingManager.FindName("NewWeigh") == null)
            {
                Frame newWeighFrame = new Frame();
                newWeighFrame.Content = new SelectACPage(new SelectAircraftViewModel(Context));
                newWeighFrame.Name = "NewWeigh";
                DockingManager.SetHeader(newWeighFrame, "New Weigh");
                DockingManager.SetState(newWeighFrame, DockState.Document);
                DockingManager.SetIsSelectedTab(newWeighFrame, true);
                SyncDockingManager.Children.Add(newWeighFrame);
            }
            else
            {
                SyncDockingManager.FindName("NewWeigh");
            }
        }

Dwayne Etchison
Replied On October 31, 2016 09:08 PM UTC

Disregard, but just to clarify i had to register the name.

Durga Rajan [Syncfusion]
Replied On November 1, 2016 12:02 PM UTC

Hi Dwayne,

We can find the child element from DockingManager by iterating the children collection of DockingManager instead of using FindName method which comes from FrameworkElement. We have prepared the sample to find the existing element by name. In this sample we have FindChild method which returns the child element corresponding to the name of that child. Please download the sample from the below link.

Sample:DockingManager_Sample

Please let us know more details about the requirement if we have misunderstood your query.

Regards,
Durga S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;