Posts

Showing posts from November, 2008

WPF, visibility and hiding controls using presentation models

In WPF, the data context for a control often sets the range of data available for binding. Using a presentation model, you can provide properties that are easy to bind to and provide some conditional display logic. For example, if your presentation model has the following fields: bool HasTitle { get; } string Title { get; } IList DataList { get; } Then you can use these fields to bind. For example, create a new UserControl and in code (say in a spring container) set the DataContext to the presentation model. Then in the resource section of the control: <UserControl.Resources> <CollectionViewSource x:Key="dataList" Source="{Binding Source=DataList}"/> </UserControl.Resource> then use this as the source for your list views, etc. Gn the section where you define the controls that make up the user control you can toggle the visibility of different elements: <Style x:Key="smallTitleStyle" TargetType="TextBlock">

eclipse, RCP, spring, hibernate and XAML Soyatec UPF

After playing around with jface data binding and straight eclipse APIs for building data driven db screens, as well as uface and rolling my own framework modeled after inpowersoft's framework, I am also looking at the XAML product (free but not open source at this point) from soyatec. I have been pleasantly surprised at the quality of the implementation so far and the ability to do easy data binding. The only area where more documentation is needed is where the XAML is backed by a java class and you need to access or set resources or data context's of individual content controls (etc.) In WPF, this happens automatically through partial classes. In UPF, you need to program a little code to make this happen. The API is not obvious but I am working towards a fuller understanding. In addition, I am learning XAML. I have determined that while XML is not the greatest specification language for this, its relatively straight forward and seems to work pretty good. I will complete a min