一段完整的Silverlight演示代码[Page.xaml]

<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="SilverlightInterview.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800" Height="1000">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>

            <RowDefinition Height="30"/>
            <RowDefinition Height="200"/>
            <RowDefinition Height="500"/>
        </Grid.RowDefinitions>
        <TextBlock Grid.Column="1" Grid.Row="0" Text="公告管理" FontSize="30"  HorizontalAlignment="Center" VerticalAlignment="Center" />
        <StackPanel x:Name="s1" Grid.Row="1" Grid.Column="0" Orientation="Horizontal" MouseEnter="s1_MouseEnter">


            <StackPanel.Resources>
                <Storyboard x:Name="colorStoryboard2">
                    <ColorAnimation BeginTime="00:00:00" Storyboard.TargetName="mySolidColorBrush"
            Storyboard.TargetProperty="Color" From="AliceBlue" To="Bisque"  Duration="0:0:4" FillBehavior="Stop"/>
                </Storyboard>
            </StackPanel.Resources>
            <StackPanel.Background>
                <SolidColorBrush x:Name="mySolidColorBrush" Color="AliceBlue" />
            </StackPanel.Background>

            <TextBlock Text="标题:" FontSize="14"></TextBlock>
            <Border Background="Coral" Width="200" Padding="2" CornerRadius="20">
                <TextBox Width="170" x:Name="topic">
                    <ToolTipService.ToolTip>
                           <StackPanel Orientation="Vertical">
                               <Image Source="image/a.JPG"></Image>
                               <TextBlock Text="阿苏大翻领卡送风口哈萨克"></TextBlock><Ellipse x:Name="ellipse1" Width="120" Height="120" Fill="Orange"></Ellipse>
                            <CheckBox Content="哈哈"></CheckBox>
                            <CheckBox Content="噢噢"></CheckBox>
                            <CheckBox Content="赫赫"></CheckBox>
                            <ProgressBar Value=""></ProgressBar>
                               <Button  Content="卡可" Width="90"></Button>
                            <Slider Value="200" Minimum="100" Maximum="800"  SmallChange="10" LargeChange="25"></Slider>
                            <basics:Calendar></basics:Calendar>
                        </StackPanel>                    
                    </ToolTipService.ToolTip>
                </TextBox>
            </Border>
          
            <TextBlock HorizontalAlignment="Right" Text="内容:" FontSize="14"></TextBlock>
            <Border Background="Coral" Width="200" Padding="2" CornerRadius="20">
                <TextBox Width="170" x:Name="remark" MouseEnter="remark_MouseEnter" MouseLeftButtonDown="remark_MouseLeftButtonDown">
                    <ToolTipService.ToolTip>
        <MediaElement x:Name="media1" AutoPlay="True"  Grid.Column="0" Grid.Row="4" Source="http://localhost:4384/image/lake.wmv" Width="340" Height="180" ></MediaElement>
                    </ToolTipService.ToolTip>
                </TextBox>
            </Border>
            <Border Background="Coral" Width="80" Padding="2" CornerRadius="20">

                <Button Content="添加" Width="60" Click="Button_Click" >
                    <ToolTipService.ToolTip>
                        <TextBlock TextWrapping="Wrap" Text="点击这里添加"/>
                    </ToolTipService.ToolTip>
                </Button>
            </Border>

            <Border Background="Coral" Width="80" Padding="2" CornerRadius="20">
                <Button Content="刷新" Width="60" Click="Button_Click_1"  >
                    <ToolTipService.ToolTip>
                        <data:DataGrid  x:Name="myGrid1"   AutoGenerateColumns="False">
                            <data:DataGrid.Columns>
                                <data:DataGridTextColumn  Header="序号" Width="120"  Binding="{Binding ID}" />
                                <data:DataGridTextColumn  Header="标题" Width="220"  Binding="{Binding Topic}" />
                                <data:DataGridTextColumn  Header="内容" Width="260"  Binding="{Binding Remark}" />
                            </data:DataGrid.Columns>
                        </data:DataGrid>
                    </ToolTipService.ToolTip>
                </Button>                   
            </Border>


            <Border Background="Coral" Width="80" Padding="2" CornerRadius="20">
                <Button Content="搜索" Width="60" Click="Button_Click_2" >
                   
                </Button>
            </Border>
            <Thumb></Thumb>
            <TextBlock x:Name="msg" Text="" FontSize="14"></TextBlock>
        </StackPanel>
        <StackPanel x:Name="s2" Grid.Row="2" Grid.Column="0" Orientation="Horizontal" MouseLeave="s2_MouseLeave" MouseEnter="s2_MouseEnter">
            <StackPanel.Resources>
                <!-- Animates the rectangle's opacity. -->
                <Storyboard x:Name="opacityStoryboard1">
                    <DoubleAnimation
          Storyboard.TargetName="s2"
          Storyboard.TargetProperty="Opacity"
          From="1.0" To="0.0" Duration="0:0:1"
          AutoReverse="True"
            />
                </Storyboard>
            </StackPanel.Resources>

        </StackPanel>
        <Border Grid.Column="0" Grid.Row="3" Background="Coral" Width="auto" Padding="20" CornerRadius="20">
            <data:DataGrid  x:Name="myGrid"  MouseEnter="myGrid_MouseEnter" MouseLeave="myGrid_MouseLeave"  Grid.Column="0" Grid.Row="2" AutoGenerateColumns="False" LoadingRow="dataGrid1_LoadingRow">
                <data:DataGrid.Columns>
                    <data:DataGridTextColumn  Header="序号" Width="30"  Binding="{Binding ID}" />
                    <data:DataGridTextColumn  Header="标题" Width="200"  Binding="{Binding Topic}" />
                    <data:DataGridTextColumn  Header="内容" Width="260"  Binding="{Binding Remark}" />
                    <data:DataGridTemplateColumn Header=""  Width="80">
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Button Content="详细内容" x:Name="ButtonDetail" Click="ButtonDetail_Click"  Tag="">
                                    </Button>
                                    <Button Content="删除" x:Name="ButtonDel" Click="ButtonDel_Click_1"  Tag=""></Button>
                                </StackPanel>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>


                    </data:DataGridTemplateColumn>
                    <data:DataGridTemplateColumn Header=""  Width="80">
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox Content="哈哈"></CheckBox>
                                    <ComboBox></ComboBox>
                                   
                                </StackPanel>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>

                    </data:DataGridTemplateColumn>

                </data:DataGrid.Columns>
            </data:DataGrid>

        </Border>
        <StackPanel Loaded="StartTimer" x:Name="SP3" Grid.Column="0" Grid.Row="4" Orientation="Vertical"></StackPanel>
        <TextBlock x:Name="Stock1"></TextBlock>
        <Slider x:Name="Slider1" ValueChanged="Slider1_ValueChanged"  Minimum="100" Maximum="800"  SmallChange="10" LargeChange="25"></Slider>
</Grid>
</UserControl>

posted @ 2008-12-17 09:52  昕友软件开发  阅读(514)  评论(0编辑  收藏  举报
欢迎访问我的开源项目:xyIM企业即时通讯