contentpresenter

How do I Change the FontFamily on a ContentPresenter?

白昼怎懂夜的黑 提交于 2019-11-28 19:40:24
问题 I have a custom template for an expander that is close to the code below. I had to change some of the code to take out custom classes, brushes, etc.. <Style TargetType="{x:Type Expander}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Top" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="FontFamily" Value="Tahoma" /> <Setter Property="FontSize" Value="12" /> <Setter Property="Foreground" Value=

WPF: template or UserControl with 2 (or more!) ContentPresenters to present content in 'slots'

让人想犯罪 __ 提交于 2019-11-28 03:09:31
I am developing LOB application, where I will need multiple dialog windows (and displaying everything in one window is not an option/makes no sense). I would like to have a user control for my window that would define some styling, etc., and would have several slots where content could be inserted - for example, a modal dialog window's template would have a slot for content, and for buttons (so that user can then provide a content and set of buttons with bound ICommands). I would like to have something like this (but this doesn't work): UserControl xaml: <UserControl x:Class=

ContentPresenter within ControlTemplate cannot change attached dependency property

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 01:13:27
Why does the following simplified code not sets the font-size of the TextBlock to 50? <Window.Resources> <ControlTemplate TargetType="ContentControl" x:Key="Test"> <ContentPresenter TextBlock.FontSize="50" /> </ControlTemplate> </Window.Resources> <Grid> <ContentControl Template="{StaticResource Test}"> <TextBlock>Test should be rendered big</TextBlock> </ContentControl> </Grid> If I change the value of the FontSize property, visual studio shows me the text in the size I want. After compiling or executing the app, the size of the textblock is always reset to its default size. I have also

WPF 4 ContentPresenter TextWrapping style is not applied to implicitedly generated TextBlock

我与影子孤独终老i 提交于 2019-11-27 18:03:34
问题 If I assign a piece of text to the Content property of a ContentPresenter , a TextBlock control is generated by the ContentPresenter at render time to contain that text. If I create a style that applies to TextBlock properties and assign it to that ContentPresenter , the does not appear to apply to the implicitly generated TextBlock s. <Style x:Key="SampleStyle"> <Setter Property="TextBlock.TextWrapping" Value="Wrap"/> </Style> <ContentPresenter Content="This is a Test piece of text." Style="

ContentPresenter within ControlTemplate cannot change attached dependency property

爷,独闯天下 提交于 2019-11-26 23:29:41
问题 Why does the following simplified code not sets the font-size of the TextBlock to 50? <Window.Resources> <ControlTemplate TargetType="ContentControl" x:Key="Test"> <ContentPresenter TextBlock.FontSize="50" /> </ControlTemplate> </Window.Resources> <Grid> <ContentControl Template="{StaticResource Test}"> <TextBlock>Test should be rendered big</TextBlock> </ContentControl> </Grid> If I change the value of the FontSize property, visual studio shows me the text in the size I want. After compiling

What&#39;s the difference between ContentControl and ContentPresenter?

☆樱花仙子☆ 提交于 2019-11-26 15:37:31
I'm not sure when I should use ContentPresenter instead of ContentControl (and vice-versa). At the moment, I'm using ContentControl pretty much all the time in my DataTemplate s. When would ContentPresenter be a better choice? and why? Nir ContentControl is a base class for controls that contain other elements and have a Content -property (for example, Button ). ContentPresenter is used inside control templates to display content. ContentControl , when used directly (it's supposed to be used as a base class), has a control template that uses ContentPresenter to display it's content. My rules

What&#39;s the difference between ContentControl and ContentPresenter?

徘徊边缘 提交于 2019-11-26 04:31:20
问题 I\'m not sure when I should use ContentPresenter instead of ContentControl (and vice-versa). At the moment, I\'m using ContentControl pretty much all the time in my DataTemplate s. When would ContentPresenter be a better choice? and why? 回答1: ContentControl is a base class for controls that contain other elements and have a Content -property (for example, Button ). ContentPresenter is used inside control templates to display content. ContentControl , when used directly (it's supposed to be