controltemplate

WPF ControlTemplate vs UserControl

Hi. I've recently made an UserControl, which took quite a long time, because I had to work with custom Dependency Properties and so on... Anyways, it was just a bunch of 3 controls: TextBox, Popup with Hierarchical Tree. Now I realized I could probably write a ControlTemplate only. Hence what is the benefit of using UserControl? ...

Silverlight: Problem customizing the DatePicker template

I'm trying to override the default DatePicker template in Silverlight. I want to remove the DatePickerTextBox and replace the content of the "calendar" icon to the right of the DatePickerTextBox with just the Month and Day as the content. Here's where I'm at, there are two ContentPresenter controls each with a different way of trying to ...

Stretching a XAML Path to fill its containing element

I have a ControlTemplate with some Paths in it. I would like the Paths to stretch and fill the control they are in, such as a Button. How can I do this? What I have currently looks like this: <ControlTemplate x:Key="SomeTemplate" TargetType="Button"> <Canvas Background="AliceBlue"> <Path Data="M 99.5,50 A 49.5,49.5 0 1 1 0....

Silverlight: Deleting Template Parts

Hello, I have a question regarding template parts. I want to create a control that inherits from ChildWindow, but I don't want it to have a border, OK/Close buttons, etc. Is it an acceptable practice to remove the template parts that I don't want? I have created a copy of the ChildWindow template in Blend and removed the template p...

Change common color in ControlTemplate

I have a ControlTemplate which uses the same color in multiple elements. On certain triggers (e.g. OnMouseOver) I'd like to change that color. As far as I can see I have to define a setter for every element to change its color. Is there a way to reference a shared resource in the template that all contained elements can access, and which...

Style on ContentPresenter is not working for TargetType (HeaderedContentControl)

So, everywhere I read you can embed a style on a ContentPresenter.Resources and it will automatically apply it to any object that are of the TargetType. So I have the code below. Simple. But it does not work. Cannot figure this one. Any help?? <UserControl.Resources> <Style TargetType="TextBox" x:Key="MyStyle"> <...

Odd Border effect on ItemsControl with ScrollViewer in ControlTemplate

I've got an ItemsControl (in a DockPanel with other stuff) which has a ControlTemplate to provide a ScrollViewer because the items won't fit on the screen. With the given config, I get a strange double-border top and bottom. It looks like a grey line above the top line and another below the bottom line. The sides are unaffected. I ge...

Reusing a customized style in Silverlight

By modifying the RowStyle of a DataGrid I have created a customized grid that will display some buttons at the end of the row when the mouse hovers above the row: I created a new style for DataGridRow based on the default style. I then modified the XAML to add my buttons inside a StackPanel (details omitted): <UserControl.Resources> ...

SharePoint custom controltemplate not being applied

Hello, I'm having trouble with a custom control template. My intention is to use a custom control template on a NewForm.aspx for a list. I have created a CustomTemplate.ascx file and this is deployed to 12/Template/CONTROLTEMPLATES < SharePoint:RenderingTemplate ID="CustomListForm" runat="server" >... I have modified the schema.xml ...

WPF ControlTemplate with foreach?

I currently try to create classes for a paint-like WPF application. I have to base classes LineMovement (line from StartPoint to EndPoint) and PathMovement (line going through all points specified in a property Points of type PointCollection). These classes inherit from Control and get their looks through a ControlTemplate. Now I want t...

Maintaining default visual properties with ControlTemplate

In order to apply a triggered animation to all ToolTips in my app, I'm using a ControlTemplate. However, when using a ControlTemplate the ToolTip loses all of its default visual properties as defined, I believe, by the theme. How can I retain all properties except for those that I override? Using the following code <ToolTip Opacity="...

Cannot find the Trigger target 'stateBrush'

What is wrong with the following ControlTemplate why can't it find the named Brush? I alway get the error Cannot find the Trigger target 'stateBrush'. In my template I would start to animate the background when the state changes to WaitForActive and I want to set it to green when the state changes to Active. Pretty simple. Is my approach...

Creating a LoginStatusControl in Silverlight

I'm trying to create a login status control in silverlight where I will use multiple ControlTemplates to define conditional content. So far I have created a LoginStatusControl public class LoginStatusControl : ContentControl { // these are actually Depedency Properties public ControlTemplate LoggedInTemplate { get; set; } p...

Is it possible to create a WPF tab control template that looks nothing like a tab control?

What I'd like is a control that functions just like the tab control but instead of having the tabs along the top, the items would be displayed in a list box along the side. I imagine it's possible but haven't found any examples, I'm hoping there's someone here that's done something like this. ...

How to get current language or variation in Sharepoint (MOSS) 2007?

I would like to be able to query the current variation from within a web part or a control template so as to determine which language to use. If there is no variation then I will pick up the language from the request. Is this possible? Thanks Paul ...

Is it possible to include Xaml resouces in a ControlTemplate?

I'm working on a Silverlight templated control (i.e. it derives from Control and has its look implemented as a ControlTemplate in generic.xaml) and came across the need for a ValueConverter in one of my bindings. Normally I'd just create an instance of the ValueConverter in the Resources of the control working with but I can't figure ou...

What's a good way to parameterize a ValueConverter used in a ControlTemplate?

A templated control I'm working on uses a ValueConverter like so: <ListBox> <ListBox.Resources> <Controls:CodeDescriptionValueConverter x:Key="CodeDescriptionValueConverter"/> </ListBox.Resources> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource CodeDescriptionValueC...

In WPF, how can I handle an event in an ItemsControl ControlTemplate

Hi, I'm trying to handle an event inside an ItemsControl ControlTemplate. I have assigned the MouseUp and MouseDown events of a button (btnRight below). The problem is that when I click on the button, the event never reaches my code-behind. How do events in ControlTemplates work and what do I need to do to hook this up? I've tried assig...

Why do I get Inconsistent Binding results

I have a control template with a toggle button. This ToggleButton has it's IsChecked property one way bound to a dependancy property. If i set the dependancy property explicitly the binding works. The problem is that after I interact with the toggle button in the UI, the bindings don't update the IsChecked property if I set the depend...

Can I partially apply a ControlTemplate in WPF?

I'm pretty green when it comes to WPF, so forgive me if this is an obvious question. I'm trying to modify an existing code base that is using the Divelements SandRibbon libraries, but am finding that the GalleryButton control doesn't behave quite how I'd like. What I'd like to do is change the way GalleryButton arranges the image and la...