Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
950
Insert a DataPresenter in a panel
posted

Bonjour ,

I am trying to build a windows all with code (C#). All Work well : my problem is to insrt a DataPresenter in the DocumentContentHost. HOW DO THAT ?

Thank You Anthride

My Code is Folowing

DocumentContentHost documentContentHost11 = new DocumentContentHost ();

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

this

 

 

.XamDockManager.BeginInit();

 

 

 

this.XamDockManager.Panes.Clear();

 

 

 

 

SplitPane splitPane1 = new SplitPane();

// UnsplitPane est le trait pour positionner la souris

splitPane1.SplitterOrientation =

 

Orientation.Horizontal;

splitPane1.MaxWidth = 300;

 

 

// c'estr la lge maxi du trait a partir de la gauche par defo

 

 

 

SplitPane splitPane2 = new SplitPane();

 

 

 

XamDockManager.SetInitialLocation(splitPane2, InitialPaneLocation.DockedRight);

splitPane1.MaxWidth = 300;

 

// c'estr la lge maxi du trait a partir de laDroite (DockedRight )

 

 

 

 

//Add both SplitPanes to xamDockManager's Panes collection

 

 

 

this.XamDockManager.Panes.Add(splitPane1);

 

 

 

this.XamDockManager.Panes.Add(splitPane2);

 

 

 

//Creation des ContentPanes : c'est l'espace entre le spliterr et la marge

 

 

 

ContentPane contentPane1 = new ContentPane();

contentPane1.Header =

 

"Liste des Structures" ;

contentPane1.Width = 250;

 

 

 

XamDataPresenter MyPresenter = new XamDataPresenter ();

MyPresenter.FieldLayoutSettings =

 

new FieldLayoutSettings();

 

 

 

//Add the ContentPane to splitPane2's Panes collection

splitPane1.Panes.Add(contentPane1);

 

 

 

 

//Add both ContentPanes to the TabGroupPane's Items collection

 

 

 

DocumentContentHost documentContentHost11 = new DocumentContentHost ();

 

 

 

this.XamDockManager.Content = documentContentHost11;

 

 

 

SplitPane splitPane11 = new SplitPane();

 

 

 

###### MY PROBLEM IS HERE ####################

XamDataPresenter xamDataPresenter1;

xamDataPresenter1 =

 

new XamDataPresenter();

 

 

 

// You can data bind your instance of xamDataPresenter // instead of using the built in sample data

xamDataPresenter1.BindToSampleData =

 

true;

 

 

 

// this.layoutRoot.Children.Add(xamDataPresenter1);

splitPane11..LayoutTransform.Add(xamDataPresenter1);

 

 

// ?????????????? how insert a XamDataPresenter in the splitpane11

 

documentContentHost11.Panes.Add(splitPane11);

 

 

 

TabGroupPane tabGroupPane11 = new TabGroupPane();

splitPane11.Panes.Add(tabGroupPane11);

 

 

 

ContentPane contentPane11 = new ContentPane();

contentPane11.Header =

 

"Document11.xaml";

 

 

 

ContentPane contentPane12 = new ContentPane();

contentPane12.Header =

 

"Document12.xaml";

tabGroupPane11.Items.Add(contentPane11);

tabGroupPane11.Items.Add(contentPane12);

 

 

 

////Creation d'un ContentPanes : c'est l'espace entre le spliterr et la marge Droite dans ce cas

 

 

 

ContentPane contentPane4 = new ContentPane();

contentPane4.Header =

 

"......";

contentPane4.Width = 250;

 

 

 

////Add the ContentPane to splitPane2's Panes collection

splitPane2.Panes.Add(contentPane4);

 

 

 

this.XamDockManager.EndInit();

Parents
  • 3520
    Offline posted

    Hi caiseodev,

    I'm having the following code which seems to work fine:

    XamDockManager dockManager = new XamDockManager();
    DocumentContentHost dch = new DocumentContentHost();
    SplitPane sp = new SplitPane();
    TabGroupPane tgp = new TabGroupPane();
    ContentPane cp = new ContentPane();
    XamDataPresenter xdp = new XamDataPresenter();
    xdp.BindToSampleData = true;
    cp.Content = xdp;
    tgp.Items.Add(cp);
    sp.Panes.Add(tgp);
    dch.Panes.Add(sp);
    dockManager.Content = dch;

    this.LayoutRoot.Children.Clear();
    this.LayoutRoot.Children.Add(dockManager);

    where "LayoutRoot" is the main grid in the window.

    Please, ammend the code above so it best suits your scenario, and you should not have problems.

    Hope this helps.

Reply Children
No Data