silverlight 分页,绑定图片列,序号列

silverlight 分页,绑定图片列,序号列,第1张

概述<UserControl x:Class="xxx.TaskQueryInstance"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:d="http://schema @H_404_2@

<UserControl x:Class="xxx.TaskqueryInstance"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="400" d:DesignWIDth="1200"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             xmlns:Customs="clr-namespace:EasySL.UI.queryAndCollect">
<UserControl.Resources>
        <Style x:Key="DataGrID@R_301_5548@Style" targettype="sdk:DataGrIDColumn@R_301_5548@">
            <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
            <Setter Property="FontWeight" Value="Bold"></Setter>
        </Style>
    </UserControl.Resources>
    <GrID x:name="LayoutRoot" >
        <GrID.Resources>
            <Customs:MessageInfoIconConverter x:Key="MessageInfoIconConverter"/>
        </GrID.Resources>
        <GrID.Background>
            <linearGradIEntBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradIEntStop color="Black" Offset="0" />
                <GradIEntStop color="#09FFFFFF" Offset="1" />
                <GradIEntStop color="#CADCEBF7" Offset="0" />
                <GradIEntStop color="#4DFFFFFC" Offset="0.721" />
            </linearGradIEntBrush>
        </GrID.Background>
        <sdk:DataGrID autoGenerateColumns="False" Column@R_301_5548@Style="{StaticResource DataGrID@R_301_5548@Style}" HorizontalAlignment="left" margin="12,42,0" name="dgData" VerticalAlignment="top" >
            <sdk:DataGrID.Columns>
                <!---序列号-->
                <sdk:DataGrIDTemplateColumn @R_301_5548@="序号" WIDth="50">
                    <sdk:DataGrIDTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock HorizontalAlignment="Center" />
                        </DataTemplate>
                    </sdk:DataGrIDTemplateColumn.CellTemplate>
                </sdk:DataGrIDTemplateColumn>
                <sdk:DataGrIDTextColumn WIDth="140" Binding="{Binding IID,Mode=OneWay}" @R_301_5548@="编号" IsReadonly="True" />
                <sdk:DataGrIDTextColumn WIDth="240" Binding="{Binding 业务类型,Mode=OneWay}" @R_301_5548@="案件类型" IsReadonly="True" />
                <sdk:DataGrIDTextColumn WIDth="70" Binding="{Binding 受理人,Mode=OneWay}" @R_301_5548@="受理人" IsReadonly="True" />
                <sdk:DataGrIDTextColumn WIDth="140" Binding="{Binding 接件时间,StringFormat=yyyy/MM/dd}" @R_301_5548@="接件时间" IsReadonly="True" />
                <sdk:DataGrIDTemplateColumn WIDth="60" @R_301_5548@="优先级" IsReadonly="True" >
                    <sdk:DataGrIDTemplateColumn.CellTemplate>
                        <!--普通图片模式-->
                        <!---Customs: 引用命名空间-->
                        <DataTemplate xmlns:Customs="clr-namespace:EasySL.UI.queryAndCollect">
                            <GrID>
                                <GrID.Resources>
                                    <Customs:MessageInfoIconConverter x:Key="MessageInfoIconConverter"/>
                                </GrID.Resources>
                            <Image WIDth="15" Height="15" Source="{Binding Path=优先级,Converter={StaticResource MessageInfoIconConverter}}">
                                    <tooltipService.tooltip>
                                    <TextBlock Text="{Binding Path=优先级}"/>
                                    </tooltipService.tooltip>
                                </Image>
                            </GrID>
                            </DataTemplate>
                    </sdk:DataGrIDTemplateColumn.CellTemplate>
                </sdk:DataGrIDTemplateColumn>
                <sdk:DataGrIDTemplateColumn @R_301_5548@="详细" WIDth="70">
                    <sdk:DataGrIDTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <sdk:Label HorizontalAlignment="Center" Content="详细" Cursor="Hand" Foreground="#FF25A128" MouseleftbuttonDown="lblCk_MouseleftbuttonDown"  name="lblCk" Tag="{Binding IID}" />
                        </DataTemplate>
                    </sdk:DataGrIDTemplateColumn.CellTemplate>
                </sdk:DataGrIDTemplateColumn>
            </sdk:DataGrID.Columns>
        </sdk:DataGrID>
        <button Content="显示图表" Height="23" HorizontalAlignment="left" margin="633,13,0" name="btnXstb" VerticalAlignment="top" WIDth="75" Click="btnXstb_Click" />
        <button Content="返回" Height="23" HorizontalAlignment="left" margin="709,0" name="btnBack" VerticalAlignment="top" WIDth="75" Click="btnBack_Click" />
        <sdk:DataPager x:name="dpPage" PageSize="14" displayMode="FirstLastPrevIoUsNext"
PageIndexChanged="dpPage_PageIndexChanged"   Height="20"
VerticalAlignment="Bottom" d:LayoutOverrIDes="WIDth"/>

    </GrID>
</UserControl>

 

 

 

using System;
using System.Collections.Generic;
using System.linq;
using System.Net;
using System.windows;
using System.windows.Controls;
using System.windows.documents;
using System.windows.input;
using System.windows.Media;
using System.windows.Media.Animation;
using System.windows.Shapes;
using EasySL.Entity;
using EasySL.UI.GetWebService;
using System.IO.IsolatedStorage;
using System.windows.Media.Imaging;
using System.windows.Data;
using System.Collections.ObjectModel;
using System.Text;
using System.windows.Markup;

namespace xxx{
    public partial class TaskqueryInstance : UserControl
    {
        public string searchWord = string.Empty;
        WsMenuServiceSoapClIEnt clIEnt = new WsMenuServiceSoapClIEnt();
        public TaskqueryInstance()
        {
            InitializeComponent();
            //绑定
            dgData.LoadingRow += new EventHandler<DataGrIDRowEventArgs>(dgData_LoadingRow);
            //给分页控件赋初始值
            this.dpPage.source = null;
            //用独立存储空间页面传值
            IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
            Dictionary<string,string> dic=appSettings["bjcx"] as Dictionary<string,string>;
            clIEnt.SearchFlowDataGrIDCompleted += new EventHandler<SearchFlowDataGrIDCompletedEventArgs>(clIEnt_SearchFlowDataGrIDCompleted);
            clIEnt.SearchFlowDataGrIDAsync(dic["stime"],dic["etime"],dic["ywlx"],dic["yxj"],dic["sqDW"],dic["ywbh"],dic["ybj"],dic["wbj"],dic["yJs"],dic["wJs"],dic["yzj"],dic["wzj"],(SessionManager.Session["user"] as St_User).USERID,searchWord);
           
        }
        //显示序号列
        voID dgData_LoadingRow(object sender,DataGrIDRowEventArgs e)
        {
            int index = e.Row.GetIndex();
            var cell = dgData.Columns[0].GetCellContent(e.Row) as TextBlock;
            cell.Text = (dpPage.PageIndex*dpPage.PageSize+(index + 1)).ToString();
        }

        voID clIEnt_SearchFlowDataGrIDCompleted(object sender,SearchFlowDataGrIDCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                //分页并绑定数据
                ObservableCollection<WorkFlowItem> result = e.Result;
                PagedCollectionVIEw itemListVIEw = new PagedCollectionVIEw(result);
                this.dgData.ItemsSource = itemListVIEw;
                this.dpPage.source = itemListVIEw;
            }
            else
            {
                throw new NotImplementedException();
            }
        }

        private voID lblCk_MouseleftbuttonDown(object sender,MousebuttonEventArgs e)
        {
            Label lbl = sender as Label;
            string lblstr = lbl.Tag.ToString();
            System.windows.browser.HTMLPage.Window.Alert(lblstr);
        }

        private voID btnXstb_Click(object sender,RoutedEventArgs e)
        {

        }

        private voID btnBack_Click(object sender,RoutedEventArgs e)
        {
            this.Content = new queryAndCollect.Taskquery();
        }

        private voID dpPage_PageIndexChanged(object sender,EventArgs e)
        {
           
        }
          
    }
    //图片转换函数类
    public class MessageInfoIconConverter : IValueConverter
    {
        private const string img_PATH = @"/EasySL.UI;component/Images/";

        public object Convert(object value,System.Type targettype,object parameter,System.Globalization.CultureInfo culture)
        {
            string imgstr = value.ToString();
            if (imgstr.EndsWith("0"))
                return img_PATH+"top_ico_yxj1.png";
            else if (imgstr.Equals("1"))
                return img_PATH + "top_ico_yxj2.png";
            else
                return img_PATH + "top_ico_yxj3.png";
        }

        public object ConvertBack(object value,System.Globalization.CultureInfo culture)         {             throw new System.NotImplementedException();         }     } } 如果<Customs:MessageInfoIconConverter x:Key="MessageInfoIconConverter"/> 报找不到程序集,请编译一下

@H_404_2@ 总结

以上是内存溢出为你收集整理的silverlight 分页,绑定图片列,序号列全部内容,希望文章能够帮你解决silverlight 分页,绑定图片列,序号列所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1073266.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存