AutocompleteBox WPF invisible coté code
Bonjour,
J'ai decouvert le sdk WPF de fevrier 2010 qui contient l'autocompletebox. Apres qq petit soucis pour l'instaler j'ai trouvé un exemple sur comment l'utiliser sur le site suivant:
http://www.c-sharpcorner.com/UploadFile/dpatra/537/
Quand je telecharge son code ca fonction makgres queslques erreurs au demarage. EN revanche quand j'appel cet objet dans mon code, je l'ai coté xaml, mais il reste inconnu coté C# et tous les objet de ma page le deviennent egalement.
Voici mon code pour info:
Xaml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <UserControl x:Class="Test.UCTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:System_Windows_Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Name="gridn">
<TextBlock Name="bla"></TextBlock>
<System_Windows_Controls:AutoCompleteBox Name="abcNom" Height="120" ></System_Windows_Controls:AutoCompleteBox>
</Grid>
</UserControl> |
C#
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Test
{
/// <summary>
/// Logique d'interaction pour UCTest.xaml
/// </summary>
public partial class UCTest : UserControl
{
public UCTest()
{
InitializeComponent();
List<String> lesnomw = new List<String>();
lesnomw.Add("test");
lesnomw.Add("abc");
lesnomw.Add("testo");
lesnomw.Add("testi");
lesnomw.Add("testa");
lesnomw.Add("noir");
abcNom.ItemsSource = lesnomw;
}
}
} |