Hi, How can I programmatically set a button's template?
Polygon buttonPolygon = new Polygon();
buttonPolygon.Points = buttonPointCollection;
buttonPolygon.Stroke = Brushes.Yellow;
buttonPolygon.StrokeThickness = 2;
// create ControlTemplate based on polygon
ControlTemplate template = new ControlTemplate();
template.Childeren.Add(button...
I am creating a custom control. The contents of the control will differ a lot when in different visual states.
Can I to achieve the above, apply different control templates to the same custom control? That is define more than one control template for a custom control? If not, any clues as to how I can do this, without have as many cust...
I've got a ResourceDictionary file that contains a bunch of resources to define elements of my UI. Including one for my DialogWindows, which will just be Windows.
<Style x:Key="DialogWindow" TargetType="{x:Type Window}" >
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="WindowStyle" Value="None" />
...
I have a button, the content template of which contains two TextBlocks. How can I program the button to adjust to the amount of text in the TextBlocks?
I only know what text is going into the buttons at run time, not design time.
I was trying to go down the road of putting the TextBlocks in a Viewbox, but a ViewBox can only have one c...
Hello everybody!
In a SL4 application i need to restyle my TabItems (actually add a button in the header).
So i took the TabItem's control template from here and added the functionality i wanted.
This seems to work fine, (i could dynamically add tabitems) with one exception:
i think this posted control template is behaving somehow "...
I want to add some elements to a TextBox by using a Template with the extra elements and the original TextBox inserted in the right spot. I'm trying to use the AdornedElementPlaceholder just like you would do when making a Validation.ErrorTemplate But the AdornedElement is not showing up. I have simplified the example as much as possible...
I want to change the style of a combo box control to look like a hyperlink.
When user clicks on the hyperlink ( combo box) it show options in the combobox to select.
The idea is that I want combo box control to display as a plain text ( more readable form).
If anybody created this type of sytle please let me know.
...
I have this control template that I am writing:
<Style TargetType="{x:Type controls:InfoBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:InfoBar}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBindin...
hello,
Can someone elaborate the difference between Control template and Data template in wpf?
What should one use in case of custom controls? Like for example a stackpanel which possibly has an image and a textbox?
It seems confusing in some cases where you define a custom control using the 'Content' property.
It would be great if an...
I'm trying to find the TextBlock that is inside the control template of a comboBox.
using VisualTreeHelpar.GetChildrenCount is working only if the comboBox is declared in XAML.In that case GetChildrenCount returns 1 and a recursive search is possible.
However, if I declare the combo as a member of the Window class using code, allocated...
I'm trying to create a treeview in which I would have a list of items (containing info about emails) grouped according to the email subject. I want something similar to the bottom image
I first tried using ListView. I got some helpful suggestions how to do it on this forum, but none worked completely. Using GroupDescriptions I was abl...
I have a custom control that inherits from ContentControl. Inside the generic.xaml file is a simple Grid with 2 rows:
Row 1 - A toggle button
Row 2 - A StackPanel with a TextBlock, named "Stackpanel1"
The ToggleButton has its own nested ControlTemplate which has VisualStates for Checked/Unchecked.
Is it possible to reference "Stack...
Good day!
I have a TabControl with TabItems that have been customized via a control template. This control template specifies a trigger whereby on mouseover, the content of tab header grows slightly.
<ControlTemplate>
<Storyboard x:Key="TabHeaderGrow">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.Target...
Hi guys,
I have created a button template consisting of a border and a content presenter. A style is then wrapped around this template and applied to a button, when this button is used it is not carrying the values for horizontal and vertical alignment. In the designer the allignments are showing and the button is in the correct place, b...
Hello. I have next control template in my WPF app.
<Style TargetType="Label" x:Key="LabelStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Label">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinitio...
I want an Expander that only expands/collapse it's content when the user clicks on the header icon. (Instead of the whole header being clickable.)
Do I have to redefine the control Template to do this? How would it look like?
Where can I find the standard templates/styles for controls?
Thanks for your time.
...
is it possible to define resources in the style rather then using a template?
<ListView.Resources >
<Style TargetType="{x:Type ScrollBar}">
<Setter Property="Background" Value="Transparent" />
</Style>
</ListView.Resources>
How can I wrap this thing into:
<Style TargetType="{x:Type ListView}...
I have a ListView into a controlTemplate, such that it's property Name is not accessible in code behind. My listView is upgraded with ObservableCollection in real time with a large amount of data. How can i make ListView scroll to last element automatically, such that last element added to be seen first? Please Help!
...
I'm working on a control template for an inherited TextBox class. I'd like to use this template to add additional controls with the ScrollViewer. I can achieve that goal just fine, what I can't do recreate the border in such away that it matches the Windows look and feel.
I have Windows Classic as my theme on XP. Textboxes are typicall...
Please answear me how can i access the ListView in controlTemplate, or what event handler to use for extracting sender parameter that will be called every time my Collection is updated. Please give a solution! I make brainstorming for a week already!!
...