Posts
17
Comments
2589
Trackbacks
27
Friday, February 10, 2006
Using BitmapEffects

“You can easily apply effects like Blur or DropShadows to a UI element using BitmapEffects property.

This xaml sample:

<Image HorizontalAlignment="Left" VerticalAlignment="Top" Source="cor.jpg">
 <Image.BitmapEffect>
  <BitmapEffectGroup>
   <BitmapEffectGroup.Children>
    <BitmapEffectCollection>
      <BlurBitmapEffect Radius="2"/>
      <DropShadowBitmapEffect/>
    </BitmapEffectCollection>
   </BitmapEffectGroup.Children>
  </BitmapEffectGroup>
 </Image.BitmapEffect>
</Image> 
<TextBox Text="Hello WPF">
 <TextBox.BitmapEffect> 
  <BitmapEffectGroup>
    <BitmapEffectGroup.Children>
     <BitmapEffectCollection>
      <OuterGlowBitmapEffect GlowColor="Green" GlowSize="5" Noise="3"  />
      <DropShadowBitmapEffect/>
     </BitmapEffectCollection>
    </BitmapEffectGroup.Children>
  </BitmapEffectGroup> 
 </TextBox.BitmapEffect>
</TextBox>
Produces this effect:

As you can see various effects can be applied to the same element, just keep in mind that effects are processed in sequence so the order of appearance inside counts.”
Unfortunately Sparkle does not support direct editing of this property yet.

posted @ Friday, February 10, 2006 5:52 PM | Feedback (653)
Databinding using "Sparkle"

How to create a user interface that displays data from an external DataSource using Expression Interactive Designer (“Sparkle“)

  • Create a new Visual C# Library project named PersonsDataSource
  • Remove Class1 and add both Person and Persons class (described in my previous blog)
  • Compile project, you should now have a PersonsDataSource dll.
  • Open Sparkle and create a new Project (File ->New Project) name it as you like.
  • Now let's add a reference to our PersonsDataSource.dll using Project->Add Item to browse to the previously created assembly.
  • You'll now see the dll listed under Project references.
  • Open the Data Palette (View->Data) and select Add new CLR DataSource, browse to PersonsDataSource and select Persons item, you should now see Persons listed inside Data palette.
  • Select Persons item from Data palette and drag it to Document root surface
  • You'll be asked to select how the Persons datasource will be displayed, select ListBox and click Ok.
  • The Create Data Template appears: This dialog allows you to 'shape' the DataTemplate associated to Person object, you can select what items and what controls to map to various Person fields (in this case dialog defaults to TextBlocks) leave defaults and click Ok.
  • You'll should see the listbox filled with Persons items.
  • We now want to add 2 texboxes that will be populated with Listbox selected item.
  • Select Library palette and drag two textboxes on DocumentRoot surface.
  • Select first texbox and, on Properties palette, click on Text field and select DataBind...
  • You'll now see the Create Data Binding dialog, we need to bind to Listbox selected item so click on Element Property and select ListBox.
  • Select SelectedItem among ListBox properties.
  • Listbox contains instances of Person classes so, select Use custom path expression and type “SelectedItem.Name” (without quotes) on related textbox, then click Ok.
  • Do the same with other textbox using “SelectedItem.Age” as custom path expression.
  • Press F5 and you'll see that selecting a listbox item selection will be reflected on both textboxes and that changes on textbox contents will be moved to underlying DataSource.
posted @ Friday, February 10, 2006 1:59 PM | Feedback (73)
News

This is my personal blog.
These postings are provided "AS IS" with no warranties, and confer no rights.

Disciple