3
голосов
4ответов
8363 просмотров

Dependency property not working, trying to set through style setter

I am trying to set up a custom style for my newly made usercontrol, however i am getting the error : "Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'." I thought i had set up Dependency properties but it seemed this was not the case, so i di...

0
голосов
1ответов
164 просмотров

Basing On a style defined inside a custom control library

I'm extending the available WPF's TreeView control. I wish to add to it CheckBox behavior like Josh Smith has suggested. My goal is to encapsulate all checkbox behavior concerns from the end user (which is a different approach of what Josh Smith has done). I would like to use a style for the Tr...

9
голосов
2ответов
6425 просмотров

Applying a style to all derived classes in WPF

I want to apply a style to all classes derived from Control. Is this possible with WPF? The following example does not work. I want the Label, TextBox and Button to have a Margin of 4. <Window x:Class="WeatherInfo.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"...

6
голосов
3ответов
6754 просмотров

App.xaml style cannot be used in Usercontrol, how come?

I have a style for a textblock that is set inside my app.xaml this is then applied to textblocked through out my application and works fine. However i get an error: "could not create instance of type" if i apply this style to a textblock within my user control, how come this is a problem? <U...

2
голосов
3ответов
2946 просмотров

WPF Richtextbox FontFace/FontSize

I am currently trying to create some basic word processor features in a WPF project. I am using a RichTextBox and am aware of all of the EditingCommands (ToggleBold, ToggleItalic...ect.). The thing I am stuck on is allowing the user to change the fontsize and font face like in MS Office where the...

3
голосов
2ответов
1386 просмотров

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 ...

5
голосов
2ответов
7209 просмотров

Need help with a custom Style in WPF

I'm attempting to build some simple custom styles for the WPF Toolkit DataGrid control. I have a style for the overall DataGrid and a style for the DataGridColumnHeader. I am not setting any control templates, only basic properties. Here is what my sample DataGrid looks like with my custom styl...

1
голосов
1ответов
558 просмотров

Is there a way to attach an event in a XAML style?

I want every clickable TreeViewItem to execute TreeViewItem_MouseLeftButtonDown, is there a way to put this in the style so I don't have to define it everywhere. I could run through all children in code behind but I would think there would be an easier way to do it in a style. The following code...

15
голосов
3ответов
20403 просмотров

Removing a WPF ListView's "classic" indented border

How can I remove the "classic" indented border from around my WPF ListView control? Setting its BorderThickness to 0 does not get rid of it.

0
голосов
1ответов
434 просмотров

How to bind a WPF CollectionItem's element's Visible state to its collection index?

Assume that the below XAML is a Style applied to a Path that is a visual element of an item data template for a collection, I want to bind to the collection in such a way that if this is the first element of a collection, the path is collapsed. How can I go about doing this? <Style x:Key="Pa...

0
голосов
3ответов
161 просмотров

Strange Style Behaviour in wpf?

Ok, I was programming an app that loaded merged dictionaries on runtime to change appearance and behaviour when I got stuck : some of the controls on my forms just weren't reacting to the styles I thought they had to react to. I have tried to simplify the problem as much as I could and came up...

4
голосов
4ответов
558 просмотров

How i can recreate this effect 3D

Hi i been looking a webpage and i found out a a website with beautiful effect ,here is the link Beautifl effect I like recreate these multi layers of background and when the mouse move you see a beautiful, almost 3D, illusion going on. The shapes seem to move in a fluid like motion in 3D, a fak...

3
голосов
3ответов
3544 просмотров

ItemsCollection and alternate row coloring

I've got an itemscollection and I want to have alternate row colouring, I've looked about how to do this but can't find anything, I think this should be simple but maybe I'm missing something. It's WPF btw. <Grid> <ItemsControl Name="itemsControl"> <ItemsContr...

3
голосов
1ответов
9676 просмотров

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 MultiTri...

6
голосов
1ответов
10166 просмотров

How to change control template from Style.Triggers

I've done it this way: <Style x:Key="Button" BasedOn="{StaticResource LoginButton}" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid> <Bord...

548
голосов
18ответов
272439 просмотров

Is it possible to have multiple styles inside a TextView?

Is it possible to set multiple styles for different pieces of text inside a TextView? For instance, I am setting the text as follows: tv.setText(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3); Is it possible to have a different style for each text element? E.g., line1 bold...

1
голосов
3ответов
1933 просмотров

WPF Style.Trigger

Somebody can tell me why this trigger doesn't work: <!--Style--> <Style x:Key="Test" TargetType="{x:Type Expander}"> <Style.Triggers> <Trigger Property="IsEnabled" Value="false"> <Setter Property="IsExpanded" Value="false...

0
голосов
2ответов
1287 просмотров

Style not being applied to Datagrid Header in WPF ... Resource Issue

I'm trying to Use a Header Style for my WPF DataGrid that sits in a UserControl. but i get this: Cannot find resource named '{DataGridRowHeaderBackgroundStyle}'. Resource names are case sensitive. Error at object 'Microsoft.Windows.Controls.DataGridTextColumn' in markup file 'WPF;component/view...

8
голосов
1ответов
10452 просмотров

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 ...

1
голосов
1ответов
2300 просмотров

How to override only ItemTemplate in Custom Control

I want to create a Custom Control derived from ComboBox, however if I create custom control from visual studio template, it creates a default Style of Control and I have to then open MSDN's ControlTemplate of ComboBox and then recreate the entire ComboBox style once again in a generic.xaml What ...

6
голосов
1ответов
14098 просмотров

WPF Menuitem Border

I've run into a problem trying to implement a Menu and can't figure out what is going on. I'm trying to make a single-layer menu using the Menu control. Here is my menu code: <Menu DockPanel.Dock="Top" Height="22" Name="menu1" VerticalAlignment="Top" Background="#FF325170"> <MenuI...

4
голосов
1ответов
3061 просмотров

How to make System.Windows.MessageBox buttons styled?

I'm using System.Windows.MessageBox in a WPF app, and for some reason its buttons are styled the Windows 2000 way - not WinXP, not Aero, not the WPF default. Just gray with basic 3d borders. How can I make them appear with a more modern style? (doesn't really matter which one)

1
голосов
1ответов
2554 просмотров

WPF TabControl XP Styling Problem

I'm working on styling a TabControl on a PC runnnig Windows 7 and everything looked fine, but when I tried running it in Windows XP, I get a hideous white border around the TabControl: I believe it's the same problem fighting with luna (described here TabControl without border wpf (XP)), but I...

0
голосов
1ответов
766 просмотров

WPF: how to check what template and style is currently used on given control from code-behind?

I have a ListBox and a lot of templates that override/extend each other. How can I check from code-behind, what template currently affects my ListBox? I can access ListBox from code-behind, its Template property gives type of control this template is for, how to get Name of this template? Same ...

0
голосов
2ответов
443 просмотров

What do I use for `BasedOn` when creating a custom style for a DataGridColumnHeader in WPF?

What should I put for BasedOn in this style? <Style x:Key="DataGrid_ColumnHeaderStyle" TargetType="wt:DataGridColumnHeader" BasedOn="??????????"> <!-- I want this to be a reference to the default style --> <Setter Property="BorderBrush" Value="{Stat...

40
голосов
2ответов
113999 просмотров

WPF TabItem Header Styling

I'm trying to style a TabControl and have got 75% of the way there, but I'm having difficulty styling the actual TabItems: What I am trying to achieve is remove the default ContentPresenter so that I can make the tab items partially transparent with rounded edges instead of the place holder re...

0
голосов
2ответов
126 просмотров

Can you set the content of a button in wpf with a style?

When I try this, all the buttons turn blue, but the content isn't set. <Window.Resources> <Style TargetType="{x:Type Button}"> <Setter Property="Background" Value="Blue"/> <Setter Property="Content" Value="Edit"/> </Style> </W...

18
голосов
1ответов
12412 просмотров

OverridesDefaultStyle in WPF

Can any one explain what OverridesDefaultStyle actually does to a control? I have read MSDN, but it is not clear.

21
голосов
1ответов
14728 просмотров

How to add a trigger to a WPF custom control without overriding the existing style?

I am creating a simple custom control extending from toggle button that allows the user to specify checked and unchecked content directly in XAML. It works well but it is based on a trigger, and I don't know how to define the trigger except in a style. If I define the style, then I lose anythin...

2
голосов
2ответов
4761 просмотров

WPF Databinding and Styles with MVVM

I have a problem with databinding on a style in WPF. The basic setup looks like this: <Style x:Key="{x:Type eo:Player}" TargetType="{x:Type eo:Player}"> <Style.Triggers> <DataTrigger Binding="{Binding Team}" Value="A"> <Setter Property="T...