Skip to content

Commit c232cef

Browse files
File changes for Multipath sample
File changes for Multipath sample
1 parent 2ce06f7 commit c232cef

5 files changed

Lines changed: 56 additions & 27 deletions

File tree

Samples/Multipath_Search/Multipath_Search/MainWindow.xaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:editors="http://schemas.syncfusion.com/wpf"
5+
xmlns:editors="http://schemas.syncfusion.com/wpf"
6+
xmlns:interaction="http://schemas.microsoft.com/xaml/behaviors"
67
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
78
xmlns:local="clr-namespace:Multipath_Search"
89
mc:Ignorable="d"
910
Title="MainWindow" Height="450" Width="800">
1011
<Window.DataContext>
1112
<local:ViewModel />
1213
</Window.DataContext>
13-
<StackPanel Margin="10">
14+
<StackPanel Margin="10" VerticalAlignment="Center">
1415
<editors:SfTextBoxExt
15-
x:Name="autoComplete"
16+
x:Name="autoComplete1"
1617
Width="200"
1718
Height="40"
1819
HorizontalAlignment="Center"
@@ -26,7 +27,6 @@
2627
<Grid HorizontalAlignment="Stretch">
2728
<Grid.ColumnDefinitions>
2829
<ColumnDefinition Width="20" />
29-
<ColumnDefinition Width="1" />
3030
<ColumnDefinition Width="Auto" />
3131
</Grid.ColumnDefinitions>
3232
<TextBlock
@@ -37,14 +37,8 @@
3737
FontSize="12"
3838
FontWeight="Normal"
3939
Text="{Binding ID}" />
40-
<Border
41-
Grid.Column="1"
42-
Width="1"
43-
Margin="0,-15"
44-
BorderBrush="#D8D8D8"
45-
BorderThickness="1" />
4640
<TextBlock
47-
Grid.Column="2"
41+
Grid.Column="1"
4842
Padding="10,8,0,8"
4943
VerticalAlignment="Center"
5044
FontFamily="SegoeUI"
@@ -54,6 +48,11 @@
5448
</Grid>
5549
</DataTemplate>
5650
</editors:SfTextBoxExt.AutoCompleteItemTemplate>
51+
<interaction:Interaction.Triggers>
52+
<interaction:EventTrigger EventName="Loaded">
53+
<interaction:InvokeCommandAction Command="{Binding AutoCompleteLoaded}" CommandParameter="{Binding ElementName=autoComplete1}" />
54+
</interaction:EventTrigger>
55+
</interaction:Interaction.Triggers>
5756
</editors:SfTextBoxExt>
5857
</StackPanel>
5958
</Window>
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System;
1+
using Microsoft.Xaml.Behaviors;
2+
using Syncfusion.Windows.Controls.Input;
3+
using System;
24
using System.Collections.Generic;
35
using System.Linq;
46
using System.Text;
@@ -19,23 +21,10 @@ namespace Multipath_Search
1921
/// Interaction logic for MainWindow.xaml
2022
/// </summary>
2123
public partial class MainWindow : Window
22-
{
24+
{
2325
public MainWindow()
2426
{
2527
InitializeComponent();
26-
autoComplete.Filter = CustomFilter;
27-
}
28-
private bool CustomFilter(string search, object item)
29-
{
30-
var model = item as Model;
31-
if (model != null)
32-
{
33-
if ((model.Name.ToLower().Contains(search.ToLower())) || ((model.ID).ToString().ToLower().Contains(search.ToLower())))
34-
{
35-
return true;
36-
}
37-
}
38-
return false;
3928
}
4029
}
4130
}

Samples/Multipath_Search/Multipath_Search/Multipath_Search.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
3737
<ItemGroup>
38+
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
39+
<HintPath>..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
42+
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
43+
</Reference>
3844
<Reference Include="Syncfusion.Licensing, Version=18.3460.0.44, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
3945
<HintPath>..\packages\Syncfusion.Licensing.18.3.0.44\lib\net46\Syncfusion.Licensing.dll</HintPath>
4046
</Reference>
@@ -46,6 +52,9 @@
4652
</Reference>
4753
<Reference Include="System" />
4854
<Reference Include="System.Data" />
55+
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
56+
<HintPath>..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll</HintPath>
57+
</Reference>
4958
<Reference Include="System.Xml" />
5059
<Reference Include="Microsoft.CSharp" />
5160
<Reference Include="System.Core" />

Samples/Multipath_Search/Multipath_Search/ViewModel.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
using System;
1+
using Syncfusion.Windows.Controls.Input;
2+
using Syncfusion.Windows.Utils;
3+
using System;
24
using System.Collections.Generic;
35
using System.Collections.ObjectModel;
46
using System.Linq;
57
using System.Text;
68
using System.Threading.Tasks;
9+
using System.Windows.Input;
710

811
namespace Multipath_Search
912
{
1013
public class ViewModel
1114
{
15+
public ICommand AutoCompleteLoaded
16+
{
17+
get;
18+
private set;
19+
}
20+
1221
private ObservableCollection<Model> employeeCollection;
1322
public ObservableCollection<Model> EmployeeCollection
1423
{
@@ -17,6 +26,7 @@ public ObservableCollection<Model> EmployeeCollection
1726
}
1827
public ViewModel()
1928
{
29+
AutoCompleteLoaded = new DelegateCommand(AutoCompleteLoadedMethod);
2030
employeeCollection = new ObservableCollection<Model>();
2131
employeeCollection.Add(new Model() { ID = 1, Name = "Eric" });
2232
employeeCollection.Add(new Model() { ID = 2, Name = "James" });
@@ -28,5 +38,25 @@ public ViewModel()
2838
employeeCollection.Add(new Model() { ID = 8, Name = "Alan" });
2939
employeeCollection.Add(new Model() { ID = 9, Name = "Aaron" });
3040
}
41+
private void AutoCompleteLoadedMethod(object obj)
42+
{
43+
var autocomplete = obj as SfTextBoxExt;
44+
if (autocomplete != null)
45+
{
46+
autocomplete.Filter = CustomFilter;
47+
}
48+
}
49+
public bool CustomFilter(string search, object item)
50+
{
51+
var model = item as Model;
52+
if (model != null)
53+
{
54+
if ((model.Name.ToLower().Contains(search.ToLower())) || ((model.ID).ToString().ToLower().Contains(search.ToLower())))
55+
{
56+
return true;
57+
}
58+
}
59+
return false;
60+
}
3161
}
3262
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.19" targetFramework="net461" />
34
<package id="Syncfusion.Licensing" version="18.3.0.44" targetFramework="net461" />
45
<package id="Syncfusion.SfInput.WPF" version="18.3.0.44" targetFramework="net461" />
56
<package id="Syncfusion.SfShared.WPF" version="18.3.1.2" targetFramework="net461" />
7+
<package id="System.Windows.Interactivity.WPF" version="2.0.20525" targetFramework="net461" />
68
</packages>

0 commit comments

Comments
 (0)