controltemplate

Binding storyboard animation values

I have an enum on a viewmodel which represents one of 5 colors, and I am using a ValueConverter to convert these values into actual colors. Specifically it's for the color of each listbox item's background to change to as it is hovered over. I have a custom control with a visual state manager and a mouseover group which uses a SplineCo...

Silverlight drawing (Path) and ViewStateManger and ControlTemplates

I have to draw a number of shapes to represent an orchard. Each of these shapes are different 'shapes'. But I want the all to have the same concept of states so if that region changes state it will change color independently of the other shapes. (note they are all independent of each other and can be in different states). How do I do ...

TextBox control template with buttons

How to improve control template for custom numericupdown? <Style TargetType="{x:Type Controls:FloatTextBoxPicker}" BasedOn="{StaticResource {x:Type TextBox}}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Controls:FloatTextBoxPicker}"> <DockPanel LastChildFill="True"> ...

WPF: Accessing Elements within a ContentPresenter?

Can someone please help me out with this? I have the following template setup in WPF: <Style TargetType="{x:Type Label}" x:Key="NavLink"> <Setter Property="Template"> <Setter.Value> <ControlTemplate x:Name="NavLinkControlTemplate" TargetType="{x:Type Label}"> <Border x:Name="Na...

How to make a control with children without declaring the template tag?

I want to create a control just like a Panel. I want my control to accept some controls as childs without typing the template name, just like the Panel, as shown here: <asp:Panel runat="server"> My content <div>Content</div> </asp:Panel> I have controls with content inside without telling what is the ITemplate. I basically w...

Change ControlTemplate of ContentControl in View using MVVM

I have two resources Dock and Undock in my View which is a UserControl(Dock.xaml), Following is xaml code <Grid> <ContentControl Template="{StaticResource Dock}"/> </Grid> In DockViewModel there is property called IsDocked,if its true i need to apply Dock otherwise Undock template How to change the template in view using Vi...

Making columns in a WPF ListBox

Hi, Problem: I have a set of items which have 3 elements: Image Description Numeric Value I want to display these in a ListBox (similar to the way Excel displays emails in the summary view) however, i do not know the width of the description field. If i dont set a hard coded value for the width in the ItemTemplate im using for the...

WPF - Events on a ControlTemplate?

Does anyone know why I can't set an event on a control template?? For example, the following line of code will not compile. It does this with any events in a control template. <ControlTemplate x:Key="DefaultTemplate" TargetType="ContentControl"> <StackPanel Loaded="StackPanel_Loaded"> </StackPanel> </ControlTemplate> I am usin...

wpf popup doesn't close when focus is lost in xaml

Hi, I've written following xaml code to show a popup with the content in a expander control. all the things work ok up to the position where the popup opens when the button is clicked. but the popup wont close when I click away from it. plus as soon as I click away to close the popup my whole application seems to be freezed for a little...

GoToState does not work for ControlTemplate in UserControl

Hi, I am totally lost and I would really appreciate your help on this. My final goal is to create a user control that will contain two control templates. Square and a Circle. Based on a type the control will display one or the other. When the mouse enters the shape the Opacity will change to 0.2. The first part works but the Opacity do...

Override ControlTemplate - not Style

I'm overriding the Content of a Button. My problem is that the default style of the button gets overridden when I do this. How can I keep the old style (the old style defines mouseover, mouseout effects and the like)? This is my code: <Fluent:DropDownButton SizeDefinition="Small"> ...

Measuring controls created at runtime in WPF

Hi, I recognise this is a popular question but I couldn't find anything that answered it exactly, but I apologise if I've missed something in my searches. I'm trying to create and then measure a control at runtime using the following code (the measurements will then be used to marquee-style scroll the controls - each control is a differ...

Button growing 8 pixels when MouseOver WPF XAML

I'm dealing with a rather frustrating bug. My ultimate goal is to have an image, which glows on IsMouseOver, and can be clicked to call an event. This seems all too complicated, but the other alternative I found was creating a custom user control, which is even more excessive. This is what I've done so far: <Style x:Key="DelButton" Targ...

Trigger in WPF is not working.

I already tried for whole day, getting mad. I have a ListView, with ListView.View as GridView. Default, the mouseOver is working, ListViewItem get highlighted when I mouseover, and get selected when I click it. But after I modified the ControlTemplate, I get the template I want, but the highlight and select is gone. I use trigger, but...

ComboBox drop down not dropping

I have a style for a ComboBox that I've been using for awhile, but I wanted to tweak the color of the drop down arrow. To do this, I just took the default template for the comboBox and pasted it into my style, and changed the arrow color fill. It looks perfect - until I hit the drop down! Nothing happens. If I cut the template from the ...

WPF- How can I stop a popup in a control template from closing when clicked?

The control template is for a custom control. I have seen this question: http://stackoverflow.com/questions/619798/why-does-a-wpf-popup-close-when-its-background-area-is-clicked However I could not figure out how to bind a command to an event in the control template. I tried this: <Popup Name="Popup" ...

WPF- Is there a performance difference between using a ContentPresenter or a VirtualizingStackPanel as the itemshost in a ListBox ControlTemplate?

The question is pretty much self-explanatory. ...

Specify ControlTemplate for ItemsControl.ItemContainerStyle

The following is similar to what I'm trying to accomplish. However, I get an "Invalid PropertyDescriptor value" error on the Template Setter. I suspect it's because I didn't specify a target type for the Style; however, I don't know the container type for ItemsControl. <ItemsControl> <ItemsControl.ItemContainerStyle> <Sty...

Where can i find the default WPF Control templates?

As per this MSDN link, There is no way to replace only part of the visual tree of a control; to change the visual tree of a control you must set the Template property of the control to its new and complete ControlTemplate . I am trying to disable the click behaviour of GridViewColumnHeader ( I need to remove some trigge...

WPF DataGrid Control Template

I am trying to customize the WPF 4.0 DataGrid and need a listing of its control template (also the control template for the nested DataGridColumnHeadersPresenter - PART_ColumnHeadersPresenter). I found this link with provides many control templates, but DataGrid is missing from the list! Is there any place where the control template for ...