Click here to Skip to main content
15,913,722 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Binding images to datagrid from database using silverlight Pin
Mark Salsbery20-May-09 4:54
Mark Salsbery20-May-09 4:54 
GeneralRe: Binding images to datagrid from database using silverlight Pin
pavanip20-May-09 18:02
pavanip20-May-09 18:02 
GeneralRe: Binding images to datagrid from database using silverlight Pin
Mark Salsbery21-May-09 7:12
Mark Salsbery21-May-09 7:12 
QuestionWPF Issue Concerning Binding [modified] Pin
Tee12319-May-09 17:02
Tee12319-May-09 17:02 
QuestionRe: WPF Issue Concerning Binding Pin
Mark Salsbery20-May-09 10:52
Mark Salsbery20-May-09 10:52 
AnswerRe: WPF Issue Concerning Binding Pin
Tee12320-May-09 14:44
Tee12320-May-09 14:44 
GeneralRe: WPF Issue Concerning Binding Pin
Mark Salsbery20-May-09 14:58
Mark Salsbery20-May-09 14:58 
GeneralRe: WPF Issue Concerning Binding Pin
Tee12321-May-09 2:32
Tee12321-May-09 2:32 
GeneralRe: WPF Issue Concerning Binding Pin
Mark Salsbery21-May-09 6:21
Mark Salsbery21-May-09 6:21 
QuestionCustom window template and events Pin
armax7519-May-09 10:39
professionalarmax7519-May-09 10:39 
AnswerRe: Custom window template and events Pin
Niladri_Biswas13-Jun-09 3:29
Niladri_Biswas13-Jun-09 3:29 
QuestionCan I put Polygon inside Button Template Dynamically? Pin
salon18-May-09 23:51
salon18-May-09 23:51 
AnswerRe: Can I put Polygon inside Button Template Dynamically? Pin
Abhinav S19-May-09 3:56
Abhinav S19-May-09 3:56 
GeneralRe: Can I put Polygon inside Button Template Dynamically? Pin
salon19-May-09 23:35
salon19-May-09 23:35 
GeneralRe: Can I put Polygon inside Button Template Dynamically? Pin
Abhinav S20-May-09 4:55
Abhinav S20-May-09 4:55 
QuestionRegarding treeview using MVVM pattern PinPopular
Ravi Mori18-May-09 21:42
Ravi Mori18-May-09 21:42 
AnswerRe: Regarding treeview using MVVM pattern Pin
Pete O'Hanlon19-May-09 0:15
mvePete O'Hanlon19-May-09 0:15 
AnswerRe: Regarding treeview using MVVM pattern Pin
Mike Fuchs8-Jul-10 22:38
Mike Fuchs8-Jul-10 22:38 
GeneralRe: Regarding treeview using MVVM pattern Pin
Robert Graves6-Sep-11 9:02
Robert Graves6-Sep-11 9:02 
QuestionUserControl does not assume height of parent container Pin
ausadmin18-May-09 19:47
ausadmin18-May-09 19:47 
AnswerRe: UserControl does not assume height of parent container [modified] Pin
Mark Salsbery19-May-09 6:41
Mark Salsbery19-May-09 6:41 
The default template for a HeaderedContentControl is
<ControlTemplate TargetType="{x:Type HeaderedContentControl}">
    <StackPanel>
        <ContentPresenter ContentSource="Header"/>
        <ContentPresenter />
    </StackPanel>
</ControlTemplate>

which gives you the behavior you're seeing, because they used a StackPanel.

I would use a grid in the HeaderedContentControl template instead.
Here's an example (simplifying your example even more):
<Window.Resources>
    <Style x:Key="HeaderedContentControlStyle1" TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <ContentPresenter Grid.Row="0" ContentSource="Header"/>
                        <ContentPresenter Grid.Row="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</Window.Resources>

<Grid>
    <HeaderedContentControl Name="hcControl" Margin="20" Style="{DynamicResource HeaderedContentControlStyle1}" >
        <Grid>
            <Border Margin="5" BorderThickness="5" BorderBrush="Red" />
        </Grid>
    </HeaderedContentControl>
</Grid>


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

modified on Tuesday, May 19, 2009 12:48 PM

GeneralRe: UserControl does not assume height of parent container Pin
ausadmin19-May-09 11:05
ausadmin19-May-09 11:05 
GeneralRe: UserControl does not assume height of parent container Pin
Mark Salsbery19-May-09 11:14
Mark Salsbery19-May-09 11:14 
GeneralRe: UserControl does not assume height of parent container Pin
mick codeproject19-Jan-10 23:10
mick codeproject19-Jan-10 23:10 
QuestionHelp with positioning text pointer in TextBox after formatting. Pin
Member 232448318-May-09 10:47
Member 232448318-May-09 10:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.