![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Custom Control I am trying to create a re-useable custom control that has a specific look and allow additional items to be placed on the the control. In the middle of my control, the black area see attached I want the ablity to drop additional controls in that space without loosing the red area along the right. Do I need to place a content presenter on the control or something else? Right now when I put this custom control on my scene and try and place a button on the control I loose the red caption area. |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Custom Control Yep. I've done this with templated controls, but not with a user control. But I imagine the plot summary would be pretty much the same. I can't swear that the ContentPresenter will work in a non-template scenario, but I can't see why it wouldn't. The binding schemes it provides are pretty flexible. Add a Content dependency property to your custom control (templated or otherwise): public FrameworkElement Content { ... standard dependency property implementation } write xaml for the control (templated, or directly, depending on your base type), with a ContentPresenter control somewhere inside. and then bind the ContentPresenter's content to the Content property of your outer control, using one of a whole bunch of possible binding schemes. With templated controls, you can use a {TemplateBinding}. I'm not sure whether there's an equivalent binding mechanism for non-template controls. (I really hope that a good top-to-bottom tutorial on various was to bind things (other than databindings) shows up in the SDK some time soon). If all else fails, bind the properties with code in override OnInitialize(). And then the markup add the control to a new page: <yourXmlns:YourControl> <yourXmlns:YourControl.Content> STUFF </yourXmlns:YourControlContent> </yourXmlns:YourControl> "John Lorenzen" wrote: > I am trying to create a re-useable custom control that has a specific look > and allow additional items to be placed on the the control. In the middle > of my control, the black area see attached I want the ablity to drop > additional controls in that space without loosing the red area along the > right. Do I need to place a content presenter on the control or something > else? Right now when I put this custom control on my scene and try and > place a button on the control I loose the red caption area |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: Custom Control Yep. I've done this with templated controls, but not with a user control. But I imagine the plot summary would be pretty much the same. I can't swear that the ContentPresenter will work in a non-template scenario, but I can't see why it wouldn't. The binding schemes it provides are pretty flexible. Add a Content dependency property to your custom control (templated or otherwise): public FrameworkElement Content { ... standard dependency property implementation } write xaml for the control (templated, or directly, depending on your base type), with a ContentPresenter control somewhere inside. and then bind the ContentPresenter's content to the Content property of your outer control, using one of a whole bunch of possible binding schemes. With templated controls, you can use a {TemplateBinding}. I'm not sure whether there's an equivalent binding mechanism for non-template controls. (I really hope that a good top-to-bottom tutorial on various was to bind things (other than databindings) shows up in the SDK some time soon). If all else fails, bind the properties with code in override OnInitialize(). And then the markup add the control to a new page: <yourXmlns:YourControl> <yourXmlns:YourControl.Content> STUFF </yourXmlns:YourControlContent> </yourXmlns:YourControl> "John Lorenzen" wrote: > I am trying to create a re-useable custom control that has a specific look > and allow additional items to be placed on the the control. In the middle > of my control, the black area see attached I want the ablity to drop > additional controls in that space without loosing the red area along the > right. Do I need to place a content presenter on the control or something > else? Right now when I put this custom control on my scene and try and > place a button on the control I loose the red caption area |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Custom Control To me, from the explanation you gave, it looks like you want to create something more like a panel than a control. -- Stoitcho Goutsev (100) "John Lorenzen" <johnl@fidlar.com> wrote in message news:4675919C-1AB1-48CC-A4E9-6A86BB195535@microsoft.com... >I am trying to create a re-useable custom control that has a specific look > and allow additional items to be placed on the the control. In the middle > of my control, the black area see attached I want the ablity to drop > additional controls in that space without loosing the red area along the > right. Do I need to place a content presenter on the control or something > else? Right now when I put this custom control on my scene and try and > place a button on the control I loose the red caption area. > |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Custom Control To me, from the explanation you gave, it looks like you want to create something more like a panel than a control. -- Stoitcho Goutsev (100) "John Lorenzen" <johnl@fidlar.com> wrote in message news:4675919C-1AB1-48CC-A4E9-6A86BB195535@microsoft.com... >I am trying to create a re-useable custom control that has a specific look > and allow additional items to be placed on the the control. In the middle > of my control, the black area see attached I want the ablity to drop > additional controls in that space without loosing the red area along the > right. Do I need to place a content presenter on the control or something > else? Right now when I put this custom control on my scene and try and > place a button on the control I loose the red caption area. > |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Custom Control Stoitcho, Yes a custom panel is what i'm trying to create, does this change my implementation "Stoitcho Goutsev (100)" <100@100.com> wrote in message news:eIaBMsnAHHA.996@TK2MSFTNGP02.phx.gbl... > To me, from the explanation you gave, it looks like you want to create > something more like a panel than a control. > > > -- > Stoitcho Goutsev (100) > > "John Lorenzen" <johnl@fidlar.com> wrote in message > news:4675919C-1AB1-48CC-A4E9-6A86BB195535@microsoft.com... >>I am trying to create a re-useable custom control that has a specific look >> and allow additional items to be placed on the the control. In the >> middle >> of my control, the black area see attached I want the ablity to drop >> additional controls in that space without loosing the red area along the >> right. Do I need to place a content presenter on the control or something >> else? Right now when I put this custom control on my scene and try and >> place a button on the control I loose the red caption area. >> > > |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: Custom Control Stoitcho, Yes a custom panel is what i'm trying to create, does this change my implementation "Stoitcho Goutsev (100)" <100@100.com> wrote in message news:eIaBMsnAHHA.996@TK2MSFTNGP02.phx.gbl... > To me, from the explanation you gave, it looks like you want to create > something more like a panel than a control. > > > -- > Stoitcho Goutsev (100) > > "John Lorenzen" <johnl@fidlar.com> wrote in message > news:4675919C-1AB1-48CC-A4E9-6A86BB195535@microsoft.com... >>I am trying to create a re-useable custom control that has a specific look >> and allow additional items to be placed on the the control. In the >> middle >> of my control, the black area see attached I want the ablity to drop >> additional controls in that space without loosing the red area along the >> right. Do I need to place a content presenter on the control or something >> else? Right now when I put this custom control on my scene and try and >> place a button on the control I loose the red caption area. >> > > |
My System Specs![]() |
| | #8 (permalink) |
| Guest | Re: Custom Control Not that it is that important, but if you are creating custom panel you need to inherit from the Panel class and provide you implementation for MeasureOverride and ArrangeOverride. In this two method you just need to take into account the area that you don't want to be covered. On the other hand it looks also like HeaderedContentControl where the text on the right is the header and the rest of the elements are the content of the control. With proper tempating I believe you can get the look you want. -- HTH Stoitcho Goutsev (100) "John Lorenzen" <johnl@fidlar.com> wrote in message news:FC49BB7B-CA3E-477F-82DE-C2CAA5059DCB@microsoft.com... > Stoitcho, > > Yes a custom panel is what i'm trying to create, does this change my > implementation > > "Stoitcho Goutsev (100)" <100@100.com> wrote in message > news:eIaBMsnAHHA.996@TK2MSFTNGP02.phx.gbl... >> To me, from the explanation you gave, it looks like you want to create >> something more like a panel than a control. >> >> >> -- >> Stoitcho Goutsev (100) >> >> "John Lorenzen" <johnl@fidlar.com> wrote in message >> news:4675919C-1AB1-48CC-A4E9-6A86BB195535@microsoft.com... >>>I am trying to create a re-useable custom control that has a specific >>>look >>> and allow additional items to be placed on the the control. In the >>> middle >>> of my control, the black area see attached I want the ablity to drop >>> additional controls in that space without loosing the red area along the >>> right. Do I need to place a content presenter on the control or >>> something >>> else? Right now when I put this custom control on my scene and try and >>> place a button on the control I loose the red caption area. >>> >> >> > |
My System Specs![]() |
| | #9 (permalink) |
| Guest | Re: Custom Control Not that it is that important, but if you are creating custom panel you need to inherit from the Panel class and provide you implementation for MeasureOverride and ArrangeOverride. In this two method you just need to take into account the area that you don't want to be covered. On the other hand it looks also like HeaderedContentControl where the text on the right is the header and the rest of the elements are the content of the control. With proper tempating I believe you can get the look you want. -- HTH Stoitcho Goutsev (100) "John Lorenzen" <johnl@fidlar.com> wrote in message news:FC49BB7B-CA3E-477F-82DE-C2CAA5059DCB@microsoft.com... > Stoitcho, > > Yes a custom panel is what i'm trying to create, does this change my > implementation > > "Stoitcho Goutsev (100)" <100@100.com> wrote in message > news:eIaBMsnAHHA.996@TK2MSFTNGP02.phx.gbl... >> To me, from the explanation you gave, it looks like you want to create >> something more like a panel than a control. >> >> >> -- >> Stoitcho Goutsev (100) >> >> "John Lorenzen" <johnl@fidlar.com> wrote in message >> news:4675919C-1AB1-48CC-A4E9-6A86BB195535@microsoft.com... >>>I am trying to create a re-useable custom control that has a specific >>>look >>> and allow additional items to be placed on the the control. In the >>> middle >>> of my control, the black area see attached I want the ablity to drop >>> additional controls in that space without loosing the red area along the >>> right. Do I need to place a content presenter on the control or >>> something >>> else? Right now when I put this custom control on my scene and try and >>> place a button on the control I loose the red caption area. >>> >> >> > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exposing contained control properties from within a custom control | Martin Robins | Avalon | 1 | 04-10-2008 09:53 AM |
| Exposing contained control properties from within a custom control | Martin Robins | Avalon | 0 | 04-10-2008 09:52 AM |
| Help with Custom Control | John Lorenzen | Avalon | 0 | 11-27-2006 04:45 PM |
| custom control in dll | domi | Avalon | 7 | 03-31-2006 09:46 AM |
| How do I use Custom Control Properties in Control Templates? | Joerg Engel | Avalon | 1 | 03-24-2006 10:45 AM |