How to make overlay control above all other controls?

If you are using a Canvas or Grid in your layout, give the control to be put on top a higher ZIndex. From MSDN: <Page xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” WindowTitle=”ZIndex Sample”> <Canvas> <Rectangle Canvas.ZIndex=”3″ Width=”100″ Height=”100″ Canvas.Top=”100″ Canvas.Left=”100″ Fill=”blue”/> <Rectangle Canvas.ZIndex=”1″ Width=”100″ Height=”100″ Canvas.Top=”150″ Canvas.Left=”150″ Fill=”yellow”/> <Rectangle Canvas.ZIndex=”2″ Width=”100″ Height=”100″ Canvas.Top=”200″ Canvas.Left=”200″ Fill=”green”/> <!– Reverse the order to … Read more

How can I provide multiple conditions for data trigger in WPF?

Use MultiDataTrigger type <Style TargetType=”ListBoxItem”> <Style.Triggers> <DataTrigger Binding=”{Binding Path=State}” Value=”WA”> <Setter Property=”Foreground” Value=”Red” /> </DataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding=”{Binding Path=Name}” Value=”Portland” /> <Condition Binding=”{Binding Path=State}” Value=”OR” /> </MultiDataTrigger.Conditions> <Setter Property=”Background” Value=”Cyan” /> </MultiDataTrigger> </Style.Triggers> </Style>

WPF text Wrap vs WrapWithOverflow

Some examples: This is the original, unwrapped version: This is NoWrap. This is Wrap. The words Remove and Sample have been wrapped at the ve and le, respectively, even though there is no line break opportunity. This is WrapWithOverflow. The ve and le are not visible (they overflow the available block width) because there is … Read more

Binding to static property

If the binding needs to be two-way, you must supply a path. There’s a trick to do two-way binding on a static property, provided the class is not static : declare a dummy instance of the class in the resources, and use it as the source of the binding. <Window.Resources> <local:VersionManager x:Key=”versionManager”/> </Window.Resources> … <TextBox … Read more

What is the difference between a User Control Library and a Custom Control Library?

In practice custom controls are something you implement on the code level while you can use XAML for user controls. The custom controls extend one of the WPF control base classes and provide additional functionality through code so all the added logic and representation must be implemented inside the code. A user control is technically … Read more

Any free WPF themes? [closed]

The only one that I have found (for sale) is reuxables. A little pricey, if you ask me, but you do get 9 themes/61 variations. UPDATE 1: A WPF Contrib project … which does have 1 theme that they never released. UPDATE 2: Rudi Grobler (above) just created CodePlex community for this … starting with … Read more

How do I space out the child elements of a StackPanel?

Use Margin or Padding, applied to the scope within the container: <StackPanel> <StackPanel.Resources> <Style TargetType=”{x:Type TextBox}”> <Setter Property=”Margin” Value=”0,10,0,0″/> </Style> </StackPanel.Resources> <TextBox Text=”Apple”/> <TextBox Text=”Banana”/> <TextBox Text=”Cherry”/> </StackPanel> EDIT: In case you would want to re-use the margin between two containers, you can convert the margin value to a resource in an outer scope, f.e. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)