Question

Probably a really simple mistake, I have downloaded the WPF toolkit and placed an AutoCompleteBox on my window. How can I create a style for this control? I have tried to follow msdn but no luck so far...

http://msdn.microsoft.com/en-us/library/dd728668(v=vs.95).aspx

On my window I have:

<Controls:AutoCompleteBox style="{StaticResource acInput}"/>

In my styles I have the following:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:input="clr-namespace:System.Windows.Controls.Input"
                    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <Style x:Key="acInput" TargetType="input:AutoCompleteBox">
        <Setter Property="FontFamily" Value="Segoe UI" />
    </Style>

</ResourceDictionary>

But I have the error: The name "AutoCompleteBox" does not exist in the namespace "clrnamespace:System.Windows.Controls.Input".

Was it helpful?

Solution 2

Solved it:

Simply changed TargetType to "Controls:AutoCompleteBox"

<Style x:Key="acInput" TargetType="Controls:AutoCompleteBox">
    <Setter Property="FontFamily" Value="Segoe UI" />
</Style>

OTHER TIPS

Add the following namespace reference:

xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top