controltemplate

WPF set named style elements from code behind?

I have a user control that applies a style to button, with the style containing a ControlTemplate section. Within the ControlTemplate, there are various UI elements such as an Ellipse and a Path. If I give those elements -- the Ellipse and Path -- a name with x:Name, can I access them from code behind? It appears the style's Ellipse an...

WPF - MultiTrigger in ControlTemplate, strange behaviour.

Okay, I've not done much WPF lately and this is confusing me. I have a Style defined for RadioButton, which uses a ControlTemplate with a MultiTrigger. The gist is that I want a Border to become opaque when the mouse either hovers over it or when it's IsChecked is true. So I have the MultiTrigger, which animates the Opacity in and ou...

Is it possible to extend a ControlTemplate the same way you extend a Style in WPF?

So the thing is that I have a main ControlTemplate which defines the most basic stuff for the new button look we're designing. But I want to do 3 other control templates for this button so we can set different colors in those; but I don't want to copy paste the main ControlTemplate and change the color there, instead I want to "inherit" ...

Control template for existing controls in WPF

How to get existing control's controltemplate in WPF in XAML format(visual tree)? This is to help to create new controltemplate with the help of existing template. ...

Behaviours in ContentTemplate Triggers

Hi all, I’m loving behaviours and states in Blend 3. Typically I’m using the GoToStateAction behaviour to go to a state when an action (such as a button click) occurs. I’ve hit a snag with ControlTemplate triggers though. Blend lets me define states in the ControlTemplate, but I can’t work out how to assign the behaviour to use them....

WPF - Can I use a derived style (ie. BasedOn) when overriding the ControlTemplate?

I have a style that overrides the ControlTemplate of the element (in this case, Label). So, I can use TemplateBinding to give the consumer control of certain things within the ControlTemplate. For example, I can set FontSize and Background explicitly in the Control and have access to these values within the ControlTemplate. However, th...

Does overriding default style/controltemplates break theming?

When I override the default style/controltemplate of a standard WPF control in blend using "Edit a Copy" without modifying it (just creating a local copy of if), will this already break theming in some scenarios? In other words, do different themes provide differnt controltemplate- and/or styledefinitions for the standard controls? How c...

Online resources for premade WPF styles/control templates?

When it comes to UI design I generally don't care to do custom styling (appearance-wise), I'm not much of an artist and I hate trying to come up with interesting color schemes and the like. Are there any online repositories of premade WPF styles and/or control templates? I could have sworn I saw one before but I can't find it now, it mig...

Setting Canvas to a control template?

I have a Canvas in a ResourceDictionary xaml file like so: <Canvas x:Key="Icon"> <Path ... /> <Path ... /> </Canvas> In my code-behind I load this icon using LayoutGrid.Children.Add(FindResource("Icon") as Canvas); And this works fine. Now I want to create a button that uses the same icon as a template. So I create a cont...

WPF - Use a ControlTemplate resource within a Style

When creating a Style, is it possible to set the ControlTemplate property to a previously defined resource? For example, if I had the following in a ResourceDictionary: <ControlTemplate x:Key="MyControlTemplate" TargetType="{x:Type Button}"> ... </ControlTemplate> And then later wanted to use it in a Style like this: <Style x:Key="M...

How to alter a visual state of a ControlTemplate without replacing it?

I want to define a ToggleButton that appears with red foreground (for example) when checked, rather than the default appearance of a pressed button. I see that the visual states are maintained as named elements inside the ToggleButton's control template. What is the easiest way to replace/remove/customize a visual state WITHOUT redefin...

Looking for a Office 2007 Style zoom slider template

Has anyone seen a good template for a Office 2007 style zoom slider? As shown in this picture ...

Silverlight 3 ProgressBar Template

Hi All, I am trying to retemplate a Silverlight3 progress bar, to show the "Value" in a TextBlock within the ProgressBarIndicator, and the "Maximum" in another textblock in the ProgressBarTrack. I think that using TemplateBinding on the Value and Maximum properties would do this, but it isn't working. FYI the template I have so far i...

WPF Animation Completed Event in ControlTemplate

In my WPF application, I have the standard Generic.xaml file, which contains a style for my custom class, Frost. I need to find a way to hook up the Completed event of one of the animations to my custom Frost class, I cannot do it at runtime because it complains at me that i need to set IsFrozen to false which I do not want to do (becau...

Silverlight with using of DependencyProperty and ControlTemplate

Hello everyone, I'm starting to study Silverlight 3 and Visual Studio 2008. I've been trying to create Windows sidebar gadget with button controls that look like circles (I have couple of "roundish" png images). The behavior, I want, is the following: when the mouse hovers over the image it gets larger a bit. When we click on it, then i...

Getting a templated button's command to work

I've used a control template to change the appearance of a button in a trivial way. It now looks different, but does not behave like a button. There are really two problems: The button's command is never executed After clicking on the button, it appears selected (i.e., the ellipse turns into an ugly blue rectangle) Here's the gener...

DataBinding of a UserControl via ControlTemplate

Hello, I'm playing around with the Infragistics xamDataGrid. I'd like to display in a "Field" (= Cell) a custom UserControl and have for it the Field's DataContext. Somehow the DataContext is always null :-) Here is the XAML: <UserControl.Resources> <Style x:Key="MyTestUserControl" TargetType="{x:Type igDP:CellValuePresenter}"> ...

What's wrong with my datatrigger binding?

I have created an attached property to extend a Button class with additional state: <Button v:ExtensionHelper.OperationMode="{Binding MyObject.OperationMode}" Command="{Binding MyObject.Select}" Style="{StaticResource operationModeControlTemplateStyle}" /> Then I want to acces this value in the controltemplate using Datatriggers like ...

How can I set a property of a DropShadowEffect via a Trigger in a ControlTemplate?

I have a Button ControlTemplate and I'm trying to modify a DropShadowEffect on a Border by using a Trigger. Here is my Xaml: <Button.Template> <ControlTemplate TargetType="Button"> <Border x:Name="ButtonBorder" Margin="10" CornerRadius="5" Background="Gray"> <Border.Effect> <DropShadowEffect ShadowDepth="5" x:Name="B...

WPF DataTemplate/ControlTemplate and VS2008 designer

Hi ! Suppose you have WPF Window composed of many elements that are using DataTemplates / ControlTemplates (ItemControls ... ) But you want to see how every DataTemplate looks like in VS Designer. What more, if you define a ControlTemplate from as a Template located in another file to be able to view it with the content. Something lik...