SearchResults with Open Customers

Nov 25, 2010 at 11:40 PM

Hi all,

I really enjoyed your latest article on showing us how to create screens like Billy Hollis' famous application.

I am curious as to how would be the best practice for implementing the search results part?  I noticed that the list of Open Customers is tied to the Items collection off of the Conductor.Collection class.  Here is what I did but I am not sure if this is the best approach:

For the Customers section of the HelloScreens project:

I added a name to the Go button so that I could have a method of "PerformSearch" on the CustomersWorkspaceViewModel.cs.

I commented out the TextBlock stating "No matches found and inserted the following Xaml:

<ItemsControl x:Name="SearchItems"
                Margin="4 0 0 0">
            <StackPanel Orientation="Horizontal"
                <Button Content="+"
cal:Message.Attach="Edit($dataContext)" />
                <TextBlock Text="{Binding DisplayName, Mode=TwoWay}"
    Margin="4 0 0 0" />

In the CustomersWorkspaceViewModel, I added the following method and property:

public void Go()
    var s = string.Empty;
    var vm = createCustomerViewModel();
    vm.DisplayName = "Customer " + count++;
    vm.IsDirty = true;
    vm = createCustomerViewModel();
    vm.DisplayName = "Customer " + count++;
    vm.IsDirty = true;
    vm = createCustomerViewModel();
    vm.DisplayName = "Customer " + count++;
    vm.IsDirty = true;

private ObservableCollection<CustomerViewModel> _searchItems = new ObservableCollection<CustomerViewModel>();
public ObservableCollection<CustomerViewModel> SearchItems {
    get { return _searchItems; }

Granted, this is test code but I was playing with the idea of getting the search mechanism to work.

Please let me know what is the right way to achieve this?


Nov 26, 2010 at 2:20 PM

I'd probably do something pretty similar.

Nov 26, 2010 at 2:33 PM

Thanks Rob.  I just wanted to be sure I was on the right track.