locked
how to load user controls in dockPanel? (Vitthal Kulkarni Web Designer) - 12/21/2007 5:53 AM PST RRS feed

  • Question

  • By: Vitthal Kulkarni Web Designer


    I want to know how to load user controls in dockPanel? I want to do that on 
    button click? can any one tell me that? if any code is there send it to me 
    please! 
    
    I am a designer learning this Blend tool by my self. I want to do some 
    Transition Effects in UserControl call that one after one.
    Friday, February 22, 2008 3:08 PM

All replies

  • By: Brennon Williams


    Howdy..
    
    So the following may not be 100% accurate in terms of syntax.. I dont have 
    VS or Blend on this computer...
    
    
    Say you create a usercontrol and you call it myUC.
    
    In your main window you add a DockPanel and you name it myDock.
    
    On your button click, in the handler in the code, add something like the 
    following:
    
    //Create an instance of your usercontrol
    
    myUC TestUC = new myUC();
    //You could do some settings here for hieght width etc.. such as
    TestUC.Width = double.NaN; //This sets it to auto
    
    //So now you have the control.. add it to the dock panels children
    myDock.Children.Add(TestUC);
    
    
    
    
    You should now have your user control in the dockpanel.
    
    Take a look here for some more information:
    http://msdn2.microsoft.com/en-us/library/system.windows.controls.dockpanel.aspx
    
    HTH.
    
    Cheers
    -- 
    Want to learn how to use Blend and visual studio?
    
    http://www.learnexpressionstudio.com
    http://www.expressionblend.com
    http://www.x-coders.com
    
    
    "Vitthal Kulkarni Web Designer" wrote:
    
    > I want to know how to load user controls in dockPanel? I want to do that on 
    > button click? can any one tell me that? if any code is there send it to me 
    > please! 
    > 
    > I am a designer learning this Blend tool by my self. I want to do some 
    > Transition Effects in UserControl call that one after one.
    Monday, February 25, 2008 3:28 PM