C# 666666.com.cn?

推荐这篇日记的豆列
······已经把这个错误信息Email给管理员了,我们会尽早解决这个问题
如果你持续遇到这个错误,请到bugStack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
First some background: I'm working on an application and I'm trying to follow MVVM conventions writing it. One thing I'd like to do is to be able to give the application different "skins" to my application. The same application, but show one "skin" for one client and a different "skin" for another.
And so my questions are:
1. Is it possible to load a xaml file at run time and "assign" it to my app?
2. Can the xaml file be an external file residing in a different folder?
3. Can the application switch to another xaml file easily, or only at startup time?
So where should I start looking at for information on this? Which WPF methods, if they exist, handle this functionality?
Edit: the type of "skinning" I'm wanting to do is more than just changing the look of my controls. The idea is having a completely different UI. Different buttons, different layouts. Kinda like how one version of the app would be fully featured for experts and another version would be simplified for beginners.
6,29443573
I think this is fairly simple with the XamlReader, give this a shot, didn't try it myself, but I think it should work.
9,3951374138
As Jakob Christensen noted, you can load any XAML you want using XamlReader.Load. This doesn't apply only for styles, but UIElements as well. You just load the XAML like:
UIElement rootE
FileStream s = new FileStream(fileName, FileMode.Open);
rootElement = (UIElement)XamlReader.Load(s);
s.Close();
Then you can set it as the contents of the suitable element, e.g. for
&Window x:Class="MainWindow"
xmlns="/winfx/2006/xaml/presentation"
xmlns:x="/winfx/2006/xaml"
Title="Foo Bar"&
&Grid x:Name="layoutGrid"&
&!-- any static elements you might have --&
you could add the rootElement in the grid with:
layoutGrid.Children.Add(rootElement);
layoutGrid.SetColumn(rootElement, COLUMN);
layoutGrid.SetRow(rootElement, ROW);
You'll naturally also have to connect any events for elements inside the rootElement manually in the code-behind. As an example, assuming your rootElement contains a Canvas with a bunch of Paths, you can assign the Paths' MouseLeftButtonDown event like this:
Canvas canvas = (Canvas)LogicalTreeHelper.FindLogicalNode(rootElement, "canvas1");
foreach (UIElement ui in LogicalTreeHelper.GetChildren(canvas)) {
System.Windows.Shapes.Path path = ui as System.Windows.Shapes.P
if (path != null) {
path.MouseLeftButtonDown += this.LeftButtonD
I've not tried switching XAML files on the fly, so I cannot say if that'll really work or not.
3,02021317
You can load any XAML that you want using .
If you style all your controls in your application and define those styles in your applications resource dictionary you can load new styles defined in XAML somewhere else using XamlReader.Load and replace parts of your resource dictionary with the loaded XAML.
Your controls will change appearance accordingly.
9,96812153
I made simple markup extension, which loads xaml:
public class DynamicXamlLoader : MarkupExtension
public DynamicXamlLoader() { }
public DynamicXamlLoader(string xamlFileName)
XamlFileName = xamlFileN
public string XamlFileName { }
public override object ProvideValue(IServiceProvider serviceProvider)
var provideValue = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueT
if (provideValue == null || provideValue.TargetObject == null)
// get target
var targetObject = provideValue.TargetObject as UIE
if (targetObject == null)
// get xaml file
var xamlFile = new DirectoryInfo(Directory.GetCurrentDirectory())
.GetFiles(XamlFileName ?? GenerateXamlName(targetObject), SearchOption.AllDirectories)
.FirstOrDefault();
if (xamlFile == null)
// load xaml
using (var reader = new StreamReader(xamlFile.FullName))
return XamlReader.Load(reader.BaseStream) as UIE
private static string GenerateXamlName(UIElement targetObject)
return string.Concat(targetObject.GetType().Name, ".xaml");
This find and load MyFirstView.xaml file
&ContentControl Content="{wpf:DynamicXamlLoader XamlFileName=MyFirstView.xaml}" /&
And this fill whole UserControl (find and load MySecondView.xaml file)
&UserControl x:Class="MySecondView"
xmlns="/winfx/2006/xaml/presentation"
xmlns:x="/winfx/2006/xaml"
Content="{wpf:DynamicXamlLoader}" /&
I have done loading XAML at runtime, here is a short example
Grid grd = new Grid();
var grdEncoding = new ASCIIEncoding();
var grdBytes = grdEncoding.GetBytes(myXAML);
grd = (Grid)XamlReader.Load(new MemoryStream(grdBytes));
Grid.SetColumn(grd, 0);
Grid.SetRow(grd, 0);
parentGrid.Children.Add(grd);
private String myXAML = @" &Grid xmlns='/winfx/2006/xaml/presentation' Margin='30 10 30 65' VerticalAlignment='Bottom'&" +
"&Label Content='Date: 1-Feb-2013' FontFamily='Arial' FontSize='12' Foreground='#666666' HorizontalAlignment='Left'/&" +
"&Label Content='4'
FontFamily='Arial' FontSize='12' Foreground='#666666' HorizontalAlignment='Center'/&" +
"&Label Content='Hello World'
FontFamily='Arial' FontSize='12' Foreground='#666666' HorizontalAlignment='Right'/&" +
"&/Grid&";
What you should do is create ONE XAML file that defines the controls and let the code behind assing the styles to the controls. This can be accomplished by creating different resource dictionaries. There are many examples. The best I could find for now is:
Good luck!
5,292114699
(this is CodeProject, don't know why Google indexes it by IP) - Josh Smith wrote a great article on how to do skinning in WPF.
45.2k1082144
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled相信C# .net 的程序员们都期待一个;强大的冻结行,冻结列的js 插件;
下面我为大家献上
一、aspx页面:
引用 js 和 css (注意 jquery )是必须的
&link href=&GridviewScroll.css& rel=&stylesheet& /&
&script src=&Scripts/jquery-1.6.2.min.js&&&/script&
&script src=&Scripts/gridviewScroll.min.js&&&/script&
function gridviewScroll() {
$('#&%=dataGrid.ClientID%&').gridviewScroll({
width: pageWidth(),//获取当前页面宽度
height: 31+11*29,
freezesize: 3
$(document).ready(function () {
gridviewScroll();
$(window).resize(function () {
gridviewScroll();
});freezesize,是冻结行的列数
&asp:GridView ID=&dataGrid& runat=&server& AutoGenerateColumns=&False& Width=&100%&&
&/Columns&
&HeaderStyle CssClass=&GridviewScrollC3Header& /&
&RowStyle CssClass=&GridviewScrollC3Item& /&
&PagerStyle CssClass=&GridviewScrollC3Pager& /&
&AlternatingRowStyle CssClass=&GridviewScrollC3Item2 & /&
&/asp:GridView&注意样式:一定要写正确
二、javaScript 脚本:gridviewScroll.min.js
* GridViewScroll with jQuery v0.4.1
* http://gridviewscroll.aspcity.idv.tw/
* Copyright (c) 2012 Likol Lee
* Released under the MIT license
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &Software&), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED &AS IS&, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
(function (n) { jQuery.fn.extend({ gridviewScroll: function (t) { function pt(n, t) { pi(n, t), wi(n, t) } function pi(t, i) { t.find(&input&).each(function () { var t = n(this)[0].type, f, if (t == &checkbox& || t == &radio& || t == &text&) { var r = n(this)[0].id, u = n(this)[0].name, r = r.replace(&_Copy&, &&), u = u.replace(&_Copy&, &&); n(this)[0].name = u + &_& + i, n(this)[0].id = r + &_& + i, f = n(&#& + r), e = n(this); switch (t) { case &checkbox&: case &radio&: e.change(function () { var t = n(this).is(&:checked&); f.attr(&checked&, t) }); case &text&: e.change(function () { var t = n(this).val(); f.val(t) }) } } }) } function wi(t, i) { t.find(&select&).each(function () { var t = n(this)[0].id, r = n(this)[0].name, t = t.replace(&_Copy&, &&), r = r.replace(&_Copy&, &&), u, n(this)[0].name = r + &_& + i, n(this)[0].id = t + &_& + i, u = n(&#& + t), f = n(this), f.change(function () { var n = this.selectedI u.prop(&selectedIndex&, n) }) }) } function bi() { var a = l.attr(&id&) + &Freeze&, o, y, v, h, b, c, k, e, s, d, f, t, for (document.getElementById(a) ? it = n(&#& + a) : (it = l.clone(), it.attr(&id&, a), it.css({ position: &absolute&, width: &&, height: &100%&, top: 0, left: 0, zIndex: li }), pt(it, &freezeheader&), it.appendTo(tt)), it.show(), o = it.children().eq(0), o.css({ width: &&, height: &100%& }), o.find(&td&).each(function () { n(this)[0].style.display = && }), y = o.children().eq(0), ki(), v = w[0].length, f = 0; f & i. f++) for (t = 0; t & t++) (h = w[f][t], h != &RS& && h != &CS&) && (b = parseInt(h.split(&:&)[1]), y.children().eq(f).children().eq(b)[0].style.display = t & ct ? && : &none&); for (c = r.attr(&id&) + &Freeze&, document.getElementById(c) ? p = n(&#& + c) : (p = r.clone(), p.attr(&id&, c), p.css({ position: &absolute&, width: &&, top: 0, left: 0, zIndex: li }), pt(p, &freezeitem&), e = p.children().eq(0), k = e.attr(&id&) + &Freeze&, e.attr(&id&, k), p.appendTo(u)), e = p.children().eq(0), e.css({ width: && }), s = e.children().eq(0), s.find(&td&).each(function () { n(this)[0].style.display = && }), d = s.children().length, f = i. f & f++) for (t = 0; t & t++) t & ct ? s[0].rows[f].cells[t].style.display = && : (g = s[0].rows[f].cells[t], g.style.display = &none&); o.width() & i.width - i.railsize ? (it.show(), p.show(), p.height(r.height())) : (it.hide(), p.hide()) } function ki() { var r = 0, n, for (ct = 0, n = 0; n & w[0]. n++) { if (t = w[0][n], t == &RS& || t == &CS&) { ct++; continue } if (i.freezesize == r) r++, ct++ } } function di() { for (var r = a.children().length, u = gi() + 1, t, n = i. n & n++) t = a[0].rows[n].cells[0].children[0], t.style.height = u + &px& } function gi() { for (var e = a.children().eq(i.headerrowcount).children().length, t = 0, f, r, u, n = 0; n & n++) f = a.children().eq(i.headerrowcount).children().eq(n), r = f.children().eq(0), r[0].style.height = &auto&, u = r[0].offsetHeight, u & t && (t = u); return t } function nr() { var it = f.attr(&id&) + &VerticalRail&, r, ut, l, a, t, p, w, d, document.getElementById(it) ? o = n(&#& + it) : (o = n(nt).css({ background: i.railcolor, width: i.railsize + &px&, position: &absolute&, zIndex: ft }), o.attr(&id&, it), u.append(o), t = { right: 0 }, o.css(t), o.mousedown(function (t) { clearInterval(e); var i = n(this).offset(), r = t.clientY - i.top + n(document).scrollTop(), u = c.offset().top - i.top, f = c.height() + r & u && g(-1, !1, !0), r & f && g(1, !1, !0), e = window.setInterval(function () { var r = t.clientY - i.top + n(document).scrollTop(), u = c.offset().top - i.top, f = c.height() + r & u && g(-1, !1, !0), r & f && g(1, !1, !0) }, 200) }), o.mouseup(function () { clearInterval(e) }), o.mouseout(function () { clearInterval(e) })), r = f.attr(&id&) + &VerticalBar&, document.getElementById(r) ? c = n(&#& + r) : (c = n(nt).css({ background: i.barcolor, width: i.barsize + &px&, position: &absolute&, zIndex: ft }), c.attr(&id&, r), ut = { right: (i.railsize - i.barsize) / 2 }, c.css(ut), u.append(c), c.draggable({ axis: &y&, containment: o, start: function () { n(this).css({ backgroundColor: i.barhovercolor }) }, stop: function () { n(this).css({ backgroundColor: i.barcolor }) }, drag: function () { g(0, !1) } })), l = f.attr(&id&) + &Vertical_TIMG&, document.getElementById(l) ? v = n(&#& + l) : (v = n(wt).css({ height: i.arrowsize, position: &absolute&, zIndex: ft, top: 0 }), v.attr(&id&, l), v.attr(&src&, i.varrowtopimg), u.append(v), t = { right: 0 }, v.css(t), v.mousedown(function () { clearInterval(e), g(-1, !1, !0), e = window.setInterval(function () { g(-1, !1, !0) }, 200) }), v.mouseup(function () { clearInterval(e) }), v.mouseout(function () { clearInterval(e) })), a = f.attr(&id&) + &Vertical_BIMG&, document.getElementById(a) ? y = n(&#& + a) : (y = n(wt).css({ height: i.arrowsize, position: &absolute&, zIndex: ft }), y.attr(&id&, a), y.attr(&src&, i.varrowbottomimg), u.append(y), t = { right: 0 }, y.css(t), y.mousedown(function () { clearInterval(e), g(1, !1, !0), e = window.setInterval(function () { g(1, !1, !0) }, 200) }), y.mouseup(function () { clearInterval(e) }), y.mouseout(function () { clearInterval(e) })), p = f.attr(&id&) + &HorizontalRail&, document.getElementById(p) ? s = n(&#& + p) : (s = n(nt).css({ background: i.railcolor, height: i.railsize + &px&, position: &absolute&, zIndex: ft }), s.attr(&id&, p), u.append(s), s.mousedown(function (t) { clearInterval(e); var i = n(this).offset(), r = t.clientX - i.left + n(document).scrollLeft(), u = h.offset().left - i.left, f = h.width() + r & u && rt(-1, !0), r & f && rt(1, !0), e = window.setInterval(function () { var r = t.clientX - i.left + n(document).scrollLeft(), u = h.offset().left - i.left, f = h.width() + r & u && rt(-1, !0), r & f && rt(1, !0) }, 200) }), s.mouseup(function () { clearInterval(e) }), s.mouseout(function () { clearInterval(e) })), w = f.attr(&id&) + &HorizontalBar&, document.getElementById(w) ? h = n(&#& + w) : (h = n(nt).css({ background: i.barcolor, height: i.barsize + &px&, position: &absolute&, zIndex: ft }), h.attr(&id&, w), u.append(h), h.draggable({ axis: &x&, containment: s, start: function () { n(this).css({ backgroundColor: i.barhovercolor }) }, stop: function () { n(this).css({ backgroundColor: i.barcolor }) }, drag: function () { rt() } })), d = f.attr(&id&) + &Horizontal_LIMG&, document.getElementById(d) ? b = n(&#& + d) : (b = n(wt).css({ width: i.arrowsize, position: &absolute&, zIndex: ft, top: 0 }), b.attr(&id&, d), b.attr(&src&, i.harrowleftimg), u.append(b), b.mousedown(function () { clearInterval(e), rt(-1, !0), e = window.setInterval(function () { rt(-1, !0) }, 200) }), b.mouseup(function () { clearInterval(e) }), b.mouseout(function () { clearInterval(e) })), tt = f.attr(&id&) + &Horizontal_RIMG&, document.getElementById(tt) ? k = n(&#& + tt) : (k = n(wt).css({ width: i.arrowsize, position: &absolute&, zIndex: ft }), k.attr(&id&, tt), k.attr(&src&, i.harrowrightimg), u.append(k), k.mousedown(function () { clearInterval(e), rt(1, !0), e = window.setInterval(function () { rt(1, !0) }, 200) }), k.mouseup(function () { clearInterval(e) }), k.mouseout(function () { clearInterval(e) })) } function tr() { var n, o.css({ height: u.outerHeight() - i.railsize - i.arrowsize * 2, top: i.arrowsize }), c.css({ top: i.arrowsize }), s.css({ width: u.outerWidth() - i.railsize - i.arrowsize * 2, top: u.outerHeight() - i.railsize, left: i.arrowsize }), h.css({ top: u.outerHeight() - (i.railsize + i.barsize) / 2, left: i.arrowsize }), n = Math.max(r.outerHeight() / r[0].scrollHeight * o.outerHeight(), i.minscrollbarsize), c.css({ height: n + &px& }), t = Math.max(r.outerWidth() / r[0].scrollWidth * s.outerWidth(), i.minscrollbarsize), h.css({ width: t + &px& }), n + i.arrowsize * 2 &= r.outerHeight() ? (o.hide(), c.hide(), v.hide(), y.hide(), fi = !0) : (o.show(), c.show(), v.show(), y.show()), t + i.arrowsize * 2 &= r.outerWidth() ? (s.hide(), h.hide(), b.hide(), k.hide()) : (s.show(), h.show(), b.show(), k.show()), o.is(&:hidden&) && (tt.css({ width: ut }), l.css({ width: ut }), u.css({ width: ut }), r.css({ width: ut }), s.css({ width: ut - i.arrowsize * 2 }), t = Math.max(r.outerWidth() / r[0].scrollWidth * s.outerWidth(), i.minscrollbarsize), h.css({ width: t + &px& }), s.css({ top: u.height() - i.railsize }), h.css({ top: u.height() - (i.railsize + i.barsize) / 2 })), s.is(&:hidden&) && (o.is(&:hidden&) ? (u.css({ height: f.height() }), r.css({ height: f.height() })) : (u.css({ height: ot }), r.css({ height: ot })), o.css({ height: ot - i.arrowsize * 2 }), n = Math.max(r.outerHeight() / r[0].scrollHeight * o.outerHeight(), i.minscrollbarsize), c.css({ height: n + &px& })), v.css({ top: 0 }), y.css({ top: o.outerHeight() + i.arrowsize }), b.css({ top: r.outerHeight() }), k.css({ top: r.outerHeight(), left: s.outerWidth() + i.arrowsize }), i.arrowsize == 0 && (v.hide(), y.hide(), b.hide(), k.hide()) } function g(n, t, u) { var f = n, e, s, (t || u) && (e = 0, e = t ? n * parseInt(i.wheelstep) / 100 : n, f = parseInt(c.css(&top&)) + e * (r.outerHeight() / r[0].scrollHeight * o.outerHeight() - 1), s = r.outerHeight() - c.outerHeight() - i.arrowsize, f = Math.min(Math.max(f, i.arrowsize), s), c.css({ top: f + &px& })), l = (parseInt(c.css(&top&)) - i.arrowsize) / (o.outerHeight() - c.outerHeight()), f = l * (r[0].scrollHeight - r.outerHeight()), r.scrollTop(f), i.freezesize == 0 || h.is(&:hidden&) || (f + r.outerHeight() & r[0].scrollHeight && (f = r[0].scrollHeight - r.outerHeight()), p.scrollTop(f)) } function rt(n, t) { var u = n, f, e, t && (f = n, u = parseInt(h.css(&left&)) + f * (r.outerWidth() / r[0].scrollWidth * s.outerWidth() - 1), e = r.outerWidth() - h.outerWidth() - i.arrowsize, u = Math.min(Math.max(u, i.arrowsize), e), h.css({ left: u + &px& })), o = (parseInt(h.css(&left&)) - i.arrowsize) / (s.outerWidth() - h.outerWidth()), u = o * (r[0].scrollWidth - r.outerWidth()), u + l.outerWidth() & l[0].scrollWidth && (u = l[0].scrollWidth - l.outerWidth()), r.scrollLeft(u), l.scrollLeft(u) } function ir() { var u, r, if (st.show(), i.headerrowcount & 1) for (t = 1; t & i. t++) a.children().eq(t).show(); if (lt.find(&td&).each(function () { n(this).children().eq(0).css(&width&, &auto&) }), u = et.children().eq(0), r = [], lt.find(&td&).each(function (t) { var i = n(this)[0].childNodes[0].offsetWidth + 1; r[t] = i, n(this).children().eq(0).css({ width: i }) }), rr(), lt.find(&td&).each(function (n) { for (var s = r[n], f, e, o, t = 0; t & i. t++) (f = w[t][n], f != &RS& && f != &CS&) && (e = f.split(&:&)[0], e != &N&) && (o = f.split(&:&)[1], u.children().eq(t).children().eq(o).children().eq(0).css({ width: s })) }), st.hide(), i.headerrowcount & 1) for (t = 1; t & i. t++) a.children().eq(t).hide() } function rr() { for (var n = [], t = 0; t & i. t++) w[t] = [], n[t] = 0; return lt.find(&td&).each(function (t) { for (var o, e, f, u, r = 0; r & i. r++) if (w[r][t] != &RS& && w[r][t] != &CS&) { if (o = a.children().eq(r).children().eq(n[r]), n[r]++, e = o.attr(&rowspan&), f = o.attr(&colspan&), e = e ? parseInt(e) : 1, f = f ? parseInt(f) : 1, e != 1) for (u = u & u++) w[u][t] = &RS&; if (f != 1) { for (u = 1; u & u++) w[r][u + t] = &CS&; w[r][t] = &N:& + (n[r] - 1) } f == 1 && (w[r][t] = &Y:& + (n[r] - 1)) } }), w } function ur() { a.find(&td, th&).each(function () { n(this)[0].innerHTML = &&div&& + n(this)[0].innerHTML + &&\/div&& }) } var i = n.extend({ width: 500, height: 300, railcolor: &#F0F0F0&, barcolor: &#CDCDCD&, barhovercolor: &#606060&, bgcolor: &#F0F0F0&, freezesize: 0, arrowsize: 0, varrowtopimg: &&, varrowbottomimg: &&, harrowleftimg: &&, harrowrightimg: &&, headerrowcount: 1, railsize: 15, barsize: 15, wheelstep: 20, minscrollbarsize: 30 }, t), e = null, hi = !0, a = null, st = null, lt = null, at = !1, fi = !1, nt = &&div&&\/div&&, wt = &&img /&&, tt = null, u = null, l = null, r = null, o = null, c = null, v = null, y = null, s = null, h = null, b = null, k = null, it = null, p = null, et = null, vt = null, f = null, ht = null, d = null, w = [], ci = 0, li = 0, ft = 0, ct = -1, f = n(this), bt, kt, dt, gt, ni, ti, ii, oi, ot, yt, si, vi, ui, if (f[0] && (a = f.children().eq(0), !(a.children().length & 2))) { n.browser.msie && jQuery.browser.version == &7.0& || f.css({ position: &relative& }); var ut = i.width, fr = i.height, ei = f.attr(&id&) + &Wrapper&; if (document.getElementById(ei) ? ht = n(&#& + ei) : (ht = n(nt), ht.attr(&id&, ei), f.before(ht)), bt = f.attr(&id&) + &PanelHeader&, document.getElementById(bt) ? tt = n(&#& + bt) : (tt = n(nt), tt.attr(&id&, bt), tt.appendTo(ht)), tt.css({ background: i.bgcolor }), kt = f.attr(&id&) + &PanelItem&, document.getElementById(kt) ? u = n(&#& + kt) : (u = n(nt), u.attr(&id&, kt), u.appendTo(ht)), u.css({ background: i.bgcolor }), dt = f.attr(&id&) + &PanelHeaderContent&, document.getElementById(dt) ? (l = n(&#& + dt), l.scrollLeft(0), l.scrollTop(0)) : (l = n(nt).css({ background: &#FFFFFF& }), l.attr(&id&, dt), l.appendTo(tt)), gt = f.attr(&id&) + &PanelItemContent&, document.getElementById(gt) ? (r = n(&#& + gt), r.scrollLeft(0), r.scrollTop(0)) : (r = n(nt).css({ background: &#FFFFFF& }), r.attr(&id&, gt), r.appendTo(u), f.appendTo(r)), st = a.children().eq(0), st.attr(&id&, f.attr(&id&) + &Header&), lt = a.children().eq(i.headerrowcount), ni = f.attr(&id&) + &Copy&, document.getElementById(ni) ? et = n(&#& + ni) : (et = f.clone().children().remove().end(), et.attr(&id&, ni), et.appendTo(l), ur(), hi = !1), ti = st.attr(&id&) + &Copy&, document.getElementById(ti)) vt = n(&#& + ti); else if (vt = st.clone(!1), vt.attr(&id&, ti), pt(vt, &Copy&), vt.appendTo(et), i.headerrowcount & 1) for (ii = 1; ii & i. ii++) oi = a.children().eq(ii).clone(!1), pt(oi, &Copy&), oi.appendTo(et); if (ot = fr - tt.height(), yt = f.attr(&id&) + &PagerBottom&, document.getElementById(yt)) d = n(&#& + yt), d[0] && d.width(ut); else { var ri = a.children().eq(a.children().length - 1), er = ri.children().eq(0), ai = er.children().eq(0).children().eq(0); ai[0] != null && ai[0].tagName == &TABLE& && (document.getElementById(yt) || (d = n(nt), d.attr(&id&, yt), d.addClass(ri[0].className), u.after(d), ri.children().eq(0).appendTo(d), d.width(ut)), ri.remove()) } if (d && d[0] && (ot -= d.height()), u.css({ position: &relative&, overflow: &hidden&, width: ut, height: ot }), r.css({ overflow: &hidden&, width: u.outerWidth() - i.railsize, height: ot - i.railsize, zIndex: ci }), tt.css({ position: &relative&, overflow: &hidden&, width: ut }), l.css({ overflow: &hidden&, width: u.outerWidth() - i.railsize, zIndex: ci }), ir(), i.freezesize != 0 && di(), nr(), tr(), i.freezesize == 0 || s.is(&:hidden&) ? (si = l.attr(&id&) + &Freeze&, vi = r.attr(&id&) + &Freeze&, document.getElementById(si) && (n(&#& + si).hide(), n(&#& + vi).hide())) : bi(), !hi) return r.hover(function () { at = !0 }, function () { at = !1 }), i.freezesize == 0 || s.is(&:hidden&) || p.hover(function () { at = !0 }, function () { at = !1 }), ui = function (n) { if (at && !o.is(&:hidden&)) { var n = n || window.event, t = 0; n.wheelDelta && (t = -n.wheelDelta / 120), n.detail && (t = n.detail / 3), g(t, !0), n.preventDefault && !fi && n.preventDefault(), fi || (n.returnValue = !1) } }, yi = function () { window.addEventListener ? (this.addEventListener(&DOMMouseScroll&, ui, !1), this.addEventListener(&mousewheel&, ui, !1)) : document.attachEvent(&onmousewheel&, ui) }, yi(), this } } }), jQuery.fn.extend({ gridviewScroll: jQuery.fn.gridviewScroll }) })(jQuery)
function pageWidth() {
if ($.browser.msie) {
patMode == &CSS1Compat& ? document.documentElement.clientWidth :
document.body.clientW
return self.innerW
function pageHeight() {
if ($.browser.msie) {
patMode == &CSS1Compat& ? document.documentElement.clientHeight : document.body.clientH
return self.innerH
function PageClientHeightObject() {
this.logoHeight = 79;//标题高度
this.locationHeight = 30;//导航高度
this.shearchHeight = 38;//查询条件
this.tableHeadHeight = 31;//表头高度
this.tabHeight = 39;//tab高度
this.tableRowHeight = 33;//表格行高
this.bottomHeight = 25;//底边高度
this.pagerHegiht = 43;//分页控件高度
this.windowHeight = pageHeight();//当前页面高度
//获取表格内容高度
function GetPageClient_TableContentHeight() {
var scho = new PageClientHeightObject();
var antherHeight = scho.windowHeight - scho.logoHeight - scho.locationHeight - scho.shearchHeight - scho.tableHeadHeight - scho.pagerHegiht - scho.bottomH
return antherH
//表格分页页数
function GetPageClient_TablePageCount() {
var scho = new PageClientHeightObject();
var rowCount = GetPageClient_TableContentHeight() / scho.tableRowH
return rowC
//有tab页是iframe的高度
function GetPageClient_TabFrameHeight() {
var scho = new PageClientHeightObject();
return scho.windowHeight - scho.tabH
三样式文件GridviewScroll.css
font-family: T
font-weight:
font-size: 12
.GridviewScrollC3Header TH, .GridviewScrollC3Header TD
padding-top: 10
padding-bottom: 5
padding-left: 5
padding-right: 5
white-space:
border: 1px solid #E5E5E5;
background-color: #2a7ad2;
color: #FFF;
text-align:
vertical-align:
.GridviewScrollC3Header TH a
.GridviewScrollC3Item TD
padding: 5
white-space:
border-left: 1px solid #E5E5E5;
border-right: 1px solid #E5E5E5;
border-bottom: 1px solid #E5E5E5;
color:#2a7ad2;
background-color: #
.GridviewScrollC3Item2 TD
padding: 5
white-space:
border-left: 1px solid #E5E5E5;
border-right: 1px solid #E5E5E5;
border-bottom: 1px solid #E5E5E5;
color:#2a7ad2;
background-color: #
.GridviewScrollC3Pager
border-top: 1px solid #AAAAAA;
background-color: #FFFFFF;
.GridviewScrollC3Pager TD
padding-top: 3
font-size: 14
padding-left: 5
padding-right: 5
.GridviewScrollC3Pager A
color: #666666;
.GridviewScrollC3Pager SPAN
font-size: 16
font-weight:
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:13414次
排名:千里之外
转载:17篇
(2)(1)(1)(2)(5)(1)(1)(2)(3)(1)(2)(4)

我要回帖

更多关于 666666.com.cn 的文章

 

随机推荐