/
MainWindow.xaml
50 lines (50 loc) · 2.49 KB
/
MainWindow.xaml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<Window x:Class="HowToCreateLookUpEdit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:HowToCreateLookUpEdit"
xmlns:viewmodel="clr-namespace:HowToCreateLookUpEdit.ViewModel"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core">
<Window.DataContext>
<viewmodel:ProductListViewModel/>
</Window.DataContext>
<Grid>
<dxg:LookUpEdit Name="lookUpEdit1" ItemsSource="{Binding Path=Products}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Width="200"
DisplayMember="ProductName"
ValueMember="ID"
AddNewButtonPlacement="EditBox"
AutoComplete="True"
IncrementalFiltering="True"
AutoPopulateColumns="True"
ImmediatePopup="True"
IsPopupAutoWidth="False">
<dxmvvm:Interaction.Triggers>
<dxmvvm:EventToCommand PassEventArgsToCommand="True" Command="{Binding ShowProductFormCommand}" EventName="ProcessNewValue" SourceName="lookUpEdit1">
<dxmvvm:EventToCommand.EventArgsConverter>
<viewmodel:ProductListValueConverter/>
</dxmvvm:EventToCommand.EventArgsConverter>
</dxmvvm:EventToCommand>
</dxmvvm:Interaction.Triggers>
</dxg:LookUpEdit>
</Grid>
<dxmvvm:Interaction.Behaviors>
<dx:DialogService DialogWindowStartupLocation="CenterOwner">
<dx:DialogService.ViewTemplate>
<DataTemplate>
<local:UserControl1/>
</DataTemplate>
</dx:DialogService.ViewTemplate>
<dx:DialogService.DialogStyle>
<Style TargetType="dx:DXDialogWindow">
<Setter Property="Width" Value="345"/>
<Setter Property="Height" Value="324"/>
</Style>
</dx:DialogService.DialogStyle>
</dx:DialogService>
</dxmvvm:Interaction.Behaviors>
</Window>