Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListView height inside of a StackPanel - problem...
Message
From
20/06/2008 13:32:54
 
 
To
20/06/2008 09:37:14
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01325263
Message ID:
01325816
Views:
19
>FYI - for those interested - I also have added incremental lookup feature here by using the KeyUp method on the TextBox to update the Linq Query and filter based on CustID or CompanyName containing the incrementally typed text. Our CustID's are character based, and some users look up by ID, but some look up by comany name, so this serves both ways.

That will work. To allow for different input devices it's more common to use OnPreviewTextInput for handling text input and OnPreviewKeyDown for control characters.

>P.S. - Excuse the horrible colors... I'm just using some weird colors to see the effect of it on the rendering. I'm beginning to see the need (or place) for "Designers" (i.e. graphical UI minded types) vs. "Developers", a topic I've heard a lot about with respect to WPF.

No problem.

>Here is my final xaml:
>and the code-behind:
>
>
>
>        public void ButtonSearch_Click(object sender, RoutedEventArgs e)
>        {
>            DataClasses1DataContext db = new DataClasses1DataContext();
>
>            var CustomerFilter='%'+txtCustomerFilter.Text+'%';
>
>            var customers = from a in db.customers
>                            where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter)
>                            orderby a.custno
>                            select new { a.custno, a.company, a.phone, a.faxno };
>
>            lv2.ItemsSource = customers;
>>        }
>
You need to get away from var because it won't pass between classes.

Either pass the whole record:
            IEnumerable<customer> customers = from a in db.customers
                            where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter)
                            orderby a.custno
                            select a;
Or create a new class:
  public class dataitem
    {
    public int custno { get; set; }
    public string company { get; set; }
    public string phone { get; set; }
    public string faxno { get; set; }

    public dataitem(int cno, string c, string p, string f)
      {
      custno = cno;
      company = c;
      phone = p;
      faxno = f;
      }
    }
And return it:
            IEnumerable<dataitem> customers = from a in db.customers
                            where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter)
                            orderby a.custno
                            select new dataitem(a.custno, a.company, a.phone, a.faxno) ;
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform