Click here to Skip to main content
15,880,796 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF Expander Pin
Itamar Gigi12-Sep-16 3:09
Itamar Gigi12-Sep-16 3:09 
GeneralRe: WPF Expander Pin
Itamar Gigi12-Sep-16 2:39
Itamar Gigi12-Sep-16 2:39 
GeneralRe: WPF Expander Pin
Itamar Gigi12-Sep-16 2:45
Itamar Gigi12-Sep-16 2:45 
QuestionDynamic ContentControl > Style > DataTemplate....binding problem! Pin
Jayme658-Sep-16 6:46
Jayme658-Sep-16 6:46 
QuestionListView SelectionChanged event not firing for the first already selected row. Pin
Stephen Holdorf7-Sep-16 7:40
Stephen Holdorf7-Sep-16 7:40 
AnswerRe: ListView SelectionChanged event not firing for the first already selected row. Pin
Stephen Holdorf9-Sep-16 5:52
Stephen Holdorf9-Sep-16 5:52 
QuestionWPF Listbox - How to keep the scrolling from changing the property? Pin
dbrenth6-Sep-16 3:49
dbrenth6-Sep-16 3:49 
QuestionDoes width and height need to be explicitly defined in ControlTemplate? Pin
Imagiv5-Sep-16 6:35
Imagiv5-Sep-16 6:35 
This has always confused me and I would love to set the record straight.

Say you have this style:

<Style TargetType="{x:Type local:ControlBasedOnUserControl}">
    <Setter Property="Width" Value="50" />
    <Setter Property="Height" Value="50" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:ControlBasedOnUserControl}">
                <Border>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>


Does WPF automatically apply the width and height of the control to the template's parent element or should the width and height be bound explicitly in the template?

<Style TargetType="{x:Type local:ControlBasedOnUserControl}">
    <Setter Property="Width" Value="50" />
    <Setter Property="Height" Value="50" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:ControlBasedOnUserControl}">
                <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>


I've found that I can set a width and height regardless if it is explicitly defined in template, but that doesn't seem right. Thoughts?
QuestionComboBox - SelectedValue and SelectedItem Pin
Mycroft Holmes31-Aug-16 14:48
professionalMycroft Holmes31-Aug-16 14:48 
QuestionWPF: Reading a document's bytes into a stream to store in a database table. Pin
Stephen Holdorf31-Aug-16 10:47
Stephen Holdorf31-Aug-16 10:47 
AnswerRe: WPF: Reading a document's bytes into a stream to store in a database table. Pin
Pete O'Hanlon31-Aug-16 11:16
mvePete O'Hanlon31-Aug-16 11:16 
QuestionUWP. How to find out size of uwp Windows.Storage element? Pin
wind te26-Aug-16 22:42
wind te26-Aug-16 22:42 
AnswerRe: UWP. How to find out size of uwp Windows.Storage element? Pin
Pete O'Hanlon31-Aug-16 12:29
mvePete O'Hanlon31-Aug-16 12:29 
QuestionClosing a static WPF Window from other Window instances. Pin
Stephen Holdorf23-Aug-16 3:23
Stephen Holdorf23-Aug-16 3:23 
AnswerRe: Closing a static WPF Window from other Window instances. Pin
Stephen Holdorf23-Aug-16 4:09
Stephen Holdorf23-Aug-16 4:09 
AnswerRe: Closing a static WPF Window from other Window instances. Pin
Richard Deeming23-Aug-16 4:27
mveRichard Deeming23-Aug-16 4:27 
QuestionCommunicating Between ViewModels Pin
JBHowl18-Aug-16 2:12
JBHowl18-Aug-16 2:12 
AnswerRe: Communicating Between ViewModels Pin
Pete O'Hanlon18-Aug-16 3:24
mvePete O'Hanlon18-Aug-16 3:24 
SuggestionRe: Communicating Between ViewModels Pin
AlexaGrey8628-Aug-16 2:43
AlexaGrey8628-Aug-16 2:43 
AnswerRe: Communicating Between ViewModels Pin
Kenneth Haugland18-Aug-16 5:07
mvaKenneth Haugland18-Aug-16 5:07 
QuestionWPF / Prism: Design decision with different views for same region Pin
SutterA17-Aug-16 2:12
SutterA17-Aug-16 2:12 
AnswerRe: WPF / Prism: Design decision with different views for same region Pin
Gerry Schmitz17-Aug-16 6:22
mveGerry Schmitz17-Aug-16 6:22 
GeneralRe: WPF / Prism: Design decision with different views for same region Pin
SutterA18-Aug-16 20:05
SutterA18-Aug-16 20:05 
GeneralRe: WPF / Prism: Design decision with different views for same region Pin
Gerry Schmitz19-Aug-16 4:44
mveGerry Schmitz19-Aug-16 4:44 
AnswerRe: WPF / Prism: Design decision with different views for same region Pin
Mycroft Holmes17-Aug-16 14:31
professionalMycroft Holmes17-Aug-16 14:31 

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.