Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Custom Control

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-06-2006   #1 (permalink)
John Lorenzen
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 SpecsSystem Spec
Old 11-06-2006   #2 (permalink)
Robin Davies
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 SpecsSystem Spec
Old 11-06-2006   #3 (permalink)
Robin Davies
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 SpecsSystem Spec
Old 11-07-2006   #4 (permalink)
Stoitcho Goutsev \(100\)
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 SpecsSystem Spec
Old 11-07-2006   #5 (permalink)
Stoitcho Goutsev \(100\)
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 SpecsSystem Spec
Old 11-07-2006   #6 (permalink)
John Lorenzen
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 SpecsSystem Spec
Old 11-07-2006   #7 (permalink)
John Lorenzen
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 SpecsSystem Spec
Old 11-08-2006   #8 (permalink)
Stoitcho Goutsev \(100\)
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 SpecsSystem Spec
Old 11-08-2006   #9 (permalink)
Stoitcho Goutsev \(100\)
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 SpecsSystem Spec
Closed Thread

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


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51