Coffeehouse Thread

9 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

WPF Data binding...

Back to Forum: Coffeehouse
  • User profile image
    Rossj

    WPF Data binding ROCKS!

    This is all. (sorry am a bit excited that I got my menus hooked up to my  concrete Document sub-classes via an AppController with virtually NO CODE.... )

  • User profile image
    MasterPi

    Party? [6]

  • User profile image
    jvervoorn

    Rossj wrote:
     I got my menus hooked up to my  concrete Document sub-classes via an AppController with virtually NO CODE.... )



    I think it would be great if you gave more detail.

  • User profile image
    Sabot

    I have to say I agree !!!

    It is a piece of cake.

    WPF is a great new developer tool!

    ... as for the details, well I would say just go and try it! Install .Net 3.0, open WPF project in VS 2005 find the datasource icon, point it at a database, xml-file, web service (Basic profile 1.1) and thats just the start of the fun! It doesn't take long at all to pick up, this is were the penny drops, it's not about replacing how you code, just makes it easier to think about how you code business processes and yes ofcourse workflow.

    My only gripe about WPF is that it doesn't work with WCF ... but it will in .Net 3.5.

  • User profile image
    Rob Relyea

    Glad to hear of your excitement.  As a developer, I have to agree that databinding is one of the nicer features of WPF...it is great to program to your data, and have the UI take care of itself.

    A few links that focus on Data:
    Data Binding Overview (MSDN)
    WPF Hands on Labs (including one on databinding)

    Enjoy!

    By the way, WCF does work with WPF in .Net 3.0, however, when you want to run your WPF application as an XBAP (xaml browser application) that runs in the browser), it requires that all code can run in a partial-trust sandbox.  Much of WCF couldn't run under that environment in v3, however .Net 3.5 will have a WCF that can...

    Thanks, Rob

    Rob Relyea | Program Manager, WPF & Xaml Language Team
    robrelyea.com | /blog | /wpf | /xaml

     

  • User profile image
    Jack Poison

    Rob,

    Do you know off-hand if there are any demos / hands-on labs for changing the appearance of a scrollbar (or similar functionality)? I can change a button easily enough, but I'm kind of stuck on how to handle, say, a scroll bar where I want to modify what the arrows look like and such.

    Any help would be appreciated.

     

  • User profile image
    Rossj

    jvervoorn wrote:
    
    Rossj wrote:
     I got my menus hooked up to my  concrete Document sub-classes via an AppController with virtually NO CODE.... )



    I think it would be great if you gave more detail.


    Basically my Save menu item looks like this..

    MenuItem miFileSave = new MenuItem();
    miFileSave.Header = "_Save";
    miFileSave.SetBinding( MenuItem.IsEnabledProperty, "NeedsSave" );
    miFileSave.DataContext = myDocumentControllerInstance;

    And now in the NeedsSave property of my DocumentController I just need to use INotifyPropertyChanged's PropertyChanged event in the set{}. Technically this should be in the Model not the Controller, but I haven't had the chance to move it yet.

    End result is that the Save menu item is enabled or disabled according to my controller/model's internal state.

    I can obviously do this with "Save As", "Close" etc.

    On top of all of this, I can also use CommandBindings to assign methods for common commands (like Paste, Cut etc) and have it check whether it is valid before hand by calling my provided CanExecute event handler.

    I still have issues with WPF (like given Microsoft's opportunity to provide base functionality IN THE FRAMEWORK for things like Document models - Open/Save/Save As etc ) why it wasn't built in, in a similar fashion to the way NSDocument works in Cocoa which saves tons of time re-writing the same type of code each time I take a new job.  MVC in the box might have been nice. And the compositing engine .. more internal info and hooks into that neyond Composition Target.Rendering would have been *fantastic* and saved me a lot of pain.

    Our player is shipping and running WPF now*, with a few unavoidable caveats (i.e. I would need hooks into the compositing engine) such as the ActiveX naff-ness and the problem with MediaElement (why *exactly* can't I get at, or provide my own FilterGraph?).  I am just in the process of moving the second version of the authoring tool to WPF as well, hence the Document work.

    * I'd be interested in knowing what the most widespread WPF apps are currently, this'll be on lots and lots of big displays by the end of this year (and potentially in some very public UK places).

  • User profile image
    eddwo

    Rossj wrote:

    I still have issues with WPF (like given Microsoft's opportunity to provide base functionality IN THE FRAMEWORK for things like Document models - Open/Save/Save As etc ) why it wasn't built in, in a similar fashion to the way NSDocument works in Cocoa which saves tons of time re-writing the same type of code each time I take a new job.  MVC in the box might have been nice.


    Looks like the frameworks for that sort of thing will be in Acropolis 
    Though that is still a long way off.

  • User profile image
    magicalclick

    Yeah I love it. The fun part is that I don't have to care about the visual. I have a background thread adding visuals to the panel. But instead of creating the whole UI element myself and adding it to the panel, I just update the source of the databinding, which is extremely easy.

    Like observableCollection.Add(YesNewObject);
    So easy and intuitive.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.