Feed on
Posts
Comments

Archive for April, 2008

DragDrop part2

This is similar to the dragdrop we did in this post but instead of dragging listbox items we use datagrid rows
you can see a demo here and source is here

Read Full Post »

We can use Popup to display a tooltip at the row level in the datagrid
Here is sample code

<UserControl x:Class=”slapp1a.Page”
    xmlns=”http://schemas.microsoft.com/client/2007“
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“
             xmlns:data=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”
             Width=”600″ Height=”600″>
    <UserControl.Resources>
        <DataTemplate x:Key=”dt”>
            <StackPanel Orientation=”Horizontal”>
            <TextBlock Text=”This is a tooltip for the Row with content : “></TextBlock>
                <TextBlock Text=”{Binding}”></TextBlock>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name=”LayoutRoot” Background=”White”>
        <data:DataGrid x:Name=”dataGrid1″
                       Height=”400″
                       Width=”450″
                       Margin=”0,5,0,10″
                       AutoGenerateColumns=”True” />
        [...]

Read Full Post »

This post shows animating Item(s) in datatemplate
<UserControl x:Class=”SilverlightApplication9.Page”
xmlns=”http://schemas.microsoft.com/client/2007“
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“
xmlns:data=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”
Width=”600″ Height=”600″>
<UserControl.Resources>
<Storyboard x:Key=”sbMouseEnter”
Storyboard.TargetProperty=”FontSize”>
<DoubleAnimation From=”10″ To=”12″ Duration=”0:0:1″ />
</Storyboard>
<Storyboard x:Key=”sbMouseLeave”
Storyboard.TargetProperty=”FontSize”>
<DoubleAnimation From=”12″ To=”10″ Duration=”0:0:1″ />
</Storyboard>
<DataTemplate x:Key=”dt”>
<TextBlock Padding=”5,0,5,0″ FontSize=”10″
MouseEnter=”TextBlock_MouseEnter”
MouseLeave=”TextBlock_MouseLeave”
Text=”{Binding FirstName}”/>
</DataTemplate>
</UserControl.Resources>
<Canvas Width=”500″ Height=”500″>
<data:DataGrid x:Name=”dataGrid5″
Height=”100″ Width=”450″ Margin=”0,5,0,10″ >
<data:DataGrid.Columns>
<data:DataGridTemplateColumn Header=”Name”
CellTemplate=”{StaticResource dt}”>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>
<ListBox Margin=”150″ Height=”100″ Width=”200″
x:Name=”list1″ ItemTemplate=”{StaticResource dt}”></ListBox>
</Canvas>
</UserControl>
we create 2 storyboards without the target property set, and datatemplate, we use the same datatemplate in datagrid as well [...]

Read Full Post »

Let’s do some drag & drop of Items between listboxes. The same thing could be used for rearranging items in a control(say listbox).
we can even show what item is getting dragged around
you can see a demo here 
(Note: updated code if you drag and drop between listboxes it should be fine. Error checking is not there, [...]

Read Full Post »

GroupBox

Here is a sample template for groupbox in silverlight (mostly from groupbox in WPF)
you can download the source here

Read Full Post »

Older Posts »