Search Results

Search found 3180 results on 128 pages for 'david sauter'.

Page 63/128 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Accessing a Service from within an XNA Content Pipeline Extension

    - by David Wallace
    I need to allow my content pipeline extension to use a pattern similar to a factory. I start with a dictionary type: public delegate T Mapper<T>(MapFactory<T> mf, XElement d); public class MapFactory<T> { Dictionary<string, Mapper<T>> map = new Dictionary<string, Mapper<T>>(); public void Add(string s, Mapper<T> m) { map.Add(s, m); } public T Get(XElement xe) { if (xe == null) throw new ArgumentNullException( "Invalid document"); var key = xe.Name.ToString(); if (!map.ContainsKey(key)) throw new ArgumentException( key + " is not a valid key."); return map[key](this, xe); } public IEnumerable<T> GetAll(XElement xe) { if (xe == null) throw new ArgumentNullException( "Invalid document"); foreach (var e in xe.Elements()) { var val = e.Name.ToString(); if (map.ContainsKey(val)) yield return map[val](this, e); } } } Here is one type of object I want to store: public partial class TestContent { // Test type public string title; // Once test if true public bool once; // Parameters public Dictionary<string, object> args; public TestContent() { title = string.Empty; args = new Dictionary<string, object>(); } public TestContent(XElement xe) { title = xe.Name.ToString(); args = new Dictionary<string, object>(); xe.ParseAttribute("once", once); } } XElement.ParseAttribute is an extension method that works as one might expect. It returns a boolean that is true if successful. The issue is that I have many different types of tests, each of which populates the object in a way unique to the specific test. The element name is the key to MapFactory's dictionary. This type of test, while atypical, illustrates my problem. public class LogicTest : TestBase { string opkey; List<TestBase> items; public override bool Test(BehaviorArgs args) { if (items == null) return false; if (items.Count == 0) return false; bool result = items[0].Test(args); for (int i = 1; i < items.Count; i++) { bool other = items[i].Test(args); switch (opkey) { case "And": result &= other; if (!result) return false; break; case "Or": result |= other; if (result) return true; break; case "Xor": result ^= other; break; case "Nand": result = !(result & other); break; case "Nor": result = !(result | other); break; default: result = false; break; } } return result; } public static TestContent Build(MapFactory<TestContent> mf, XElement xe) { var result = new TestContent(xe); string key = "Or"; xe.GetAttribute("op", key); result.args.Add("key", key); var names = mf.GetAll(xe).ToList(); if (names.Count() < 2) throw new ArgumentException( "LogicTest requires at least two entries."); result.args.Add("items", names); return result; } } My actual code is more involved as the factory has two dictionaries, one that turns an XElement into a content type to write and another used by the reader to create the actual game objects. I need to build these factories in code because they map strings to delegates. I have a service that contains several of these factories. The mission is to make these factory classes available to a content processor. Neither the processor itself nor the context it uses as a parameter have any known hooks to attach an IServiceProvider or equivalent. Any ideas?

    Read the article

  • BindAttribute, Exclude nested properties for complex types

    - by David Board
    I have a 'Stream' model: public class Stream { public int ID { get; set; } [Required] [StringLength(50, ErrorMessage = "Stream name cannot be longer than 50 characters.")] public string Name { get; set; } [Required] [DataType(DataType.Url)] public string URL { get; set; } [Required] [Display(Name="Service")] public int ServiceID { get; set; } public virtual Service Service { get; set; } public virtual ICollection<Event> Events { get; set; } public virtual ICollection<Monitor> Monitors { get; set; } public virtual ICollection<AlertRule> AlertRules { get; set; } } For the 'create' view for this model, I have made a view model to pass some additional information to the view: public class StreamCreateVM { public Stream Stream { get; set; } public SelectList ServicesList { get; set; } public int SelectedService { get; set; } } Here is my create post action: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include="Stream, Stream.Name, Stream.ServiceID, SelectedService")] StreamCreateVM viewModel) { if (ModelState.IsValid) { db.Streams.Add(viewModel.Stream); db.SaveChanges(); return RedirectToAction("Index", "Service", new { id = viewModel.Stream.ServiceID }); } return View(viewModel); } Now, this all works, apart from the [Bind(Include="Stream, Stream.Name, Stream.ServiceID, SelectedService")] bit. I can't seem to Include or Exclude properties within a nested object.

    Read the article

  • Render User Controls and call their Page_Load

    - by David Murdoch
    The following code will not work because the controls (page1, page2, page3) require that their "Page_Load" event gets called. using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using iTextSharp.text; using iTextSharp.text.html.simpleparser; using iTextSharp.text.pdf; public partial class utilities_getPDF : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // add user controls to the page AddContentControl("controls/page1"); AddContentControl("controls/page2"); AddContentControl("controls/page3"); // set up the response to download the rendered PDF... Response.ContentType = "application/pdf"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.AddHeader("Content-Disposition", "attachment;filename=FileName.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); // get the rendered HTML of the page System.IO.StringWriter stringWrite = new StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); this.Render(htmlWrite); StringReader reader = new StringReader(stringWrite.ToString()); // write the PDF to the OutputStream... Document doc = new Document(PageSize.A4); HTMLWorker parser = new HTMLWorker(doc); PdfWriter.GetInstance(doc, Response.OutputStream); doc.Open(); parser.Parse(reader); doc.Close(); } // the parts are probably irrelevant to the question... private const string contentPage = "~/includes/{0}.ascx"; private void AddContentControl(string page) { content.Controls.Add(myLoadControl(page)); } private Control myLoadControl(string page) { return TemplateControl.LoadControl(string.Format(contentPage, page)); } } So my question is: How can I get the controls HTML?

    Read the article

  • Published Android apk gives error "Package file was not signed correctly"

    - by David Read
    I recently uploaded my application to the android market however it's refusing to run when downloaded due to the error Package file was not signed correctly I first published the packet using eclipse, right click export, creating a keystore then publishing, however it refuses to work. I then downloaded the keytool and jarsigner and used them to sign an upgrade which I posted instead. However this gives the same error. I have no idea what I've done wrong, and since I cannot delete the application I cannot try and start again can anyone help me? Thanks

    Read the article

  • Software development metrics and reporting

    - by David M
    I've had some interesting conversations recently about software development metrics, in particular how they can be used in a reasonably large organisation to help development teams work better. I know there have been Stack Overflow questions about which metrics are good to use - like this one, but my question is more about which metrics are useful to which stakeholders, and at what level of aggregation. As an example, my view is that code coverage is a useful metric in the following ways (and maybe others): For a team's own internal use when combined with other measurements. For facilitating/enabling/mentoring teams, where it might be instructive when considered on a team-by-team basis as a trend (e.g. if team A and B have coverage this month of 75 and 50, I'd be more concerned with team A than B if the previous month they'd had 80 and 40). For senior management when presented as an aggregated statistic across a number of teams or a whole department. But I don't think it's useful for senior management to see this on a team-by-team basis, as this encourages artifical attempts to bolster coverage with tests that merely exercise, rather than test, code. I'm in an organisation with a couple of levels in its management hierarchy, but where the vast majority of managers are technically minded and able (with many still getting their hands dirty). Some of the development teams are leading the way in driving towards agile development practices, but others lag, and there is now a serious mandate from the top for this to be the way the organisation works. A couple of us are starting a programme to encourage this. In this sort of an organisation, what sort of metrics do you think are useful, to whom, why, and at what level of aggregation? I don't want people to feel their performance is being assessed based on a metric that they can artificially influence; at the same time, the senior management are going to want some sort of evidence that progress is being made. What advice or caveats can you provide based on experience in your own organisations? EDIT We are definitely wanting to use metrics as a tool for organisational improvement not as a tool for individual performance measurement.

    Read the article

  • Ruby concatenate strings and add spaces

    - by David Oneill
    I have 4 string variables name, quest, favorite_color, speed that might be empty. I want to concatenate them all together, putting spaces between those that aren't empty. So: name = 'Tim' quest = 'destroy' favorite_color = 'red' speed = 'fast' becomes 'Tim destroy red fast' and name = 'Steve' quest = '' favorite_color = '' speed = 'slow' becomes: 'Steve slow' (Notice: there is only 1 space between 'Steve' and 'slow') How do I do that (preferably in 1 line).

    Read the article

  • Qt - drag and drop with graphics view framework

    - by David Davidson
    I'm trying to make a simple draggable item using the graphics framework. Here's the code for what I did so far: Widget class: class Widget : public QWidget { Q_OBJECT public: Widget(QWidget *parent = 0); ~Widget(); }; Widget::Widget(QWidget *parent) : QWidget(parent) { DragScene *scene = new DragScene(); DragView *view = new DragView(); QHBoxLayout *layout = new QHBoxLayout(); DragItem *item = new DragItem(); view->setAcceptDrops(true); scene->addItem(item); view->setScene(scene); layout->addWidget(view); this->setLayout(layout); } Widget::~Widget() { } DragView class: class DragView : public QGraphicsView { public: DragView(QWidget *parent = 0); }; DragView::DragView(QWidget *parent) : QGraphicsView(parent) { setRenderHints(QPainter::Antialiasing); } DragScene class: class DragScene : public QGraphicsScene { public: DragScene(QObject* parent = 0); protected: void dragEnterEvent(QGraphicsSceneDragDropEvent *event); void dragMoveEvent(QGraphicsSceneDragDropEvent *event); void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); void dropEvent(QGraphicsSceneDragDropEvent *event); }; DragScene::DragScene(QObject* parent) : QGraphicsScene(parent) { } void DragScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event){ } void DragScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event){ } void DragScene::dragLeaveEvent(QGraphicsSceneDragDropEvent *event){ } void DragScene::dropEvent(QGraphicsSceneDragDropEvent *event){ qDebug() << event->pos(); event->acceptProposedAction(); DragItem *item = new DragItem(); this->addItem(item); item->setPos(event->pos()); } DragItem class: class DragItem : public QGraphicsItem { public: DragItem(QGraphicsItem *parent = 0); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); protected: void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); }; DragItem::DragItem(QGraphicsItem *parent) : QGraphicsItem(parent) { setFlag(QGraphicsItem::ItemIsMovable); } QRectF DragItem::boundingRect() const{ const QPointF *p0 = new QPointF(-10,-10); const QPointF *p1 = new QPointF(10,10); return QRectF(*p0,*p1); } void DragItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ if(painter == 0) painter = new QPainter(); painter->drawEllipse(QPoint(0,0),10,10); } void DragItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event){ } void DragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event){ } void DragItem::mousePressEvent(QGraphicsSceneMouseEvent *event){ QMimeData* mime = new QMimeData(); QDrag* drag = new QDrag(event->widget()); drag->setMimeData(mime); drag->exec(); } void DragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ } main.cpp instantiates a Widget and shows it. When I try to drag the circle, the app just creates another circle over the original one, regardless of where I release the drag. qDebug() in DragScene's dropEvent() shows QPointF(0,0) everytime the drag ends. I'm having a hard time trying to understand exactly what I have to do, which classes I should subclass, which methods needs to be overriden, to make this work. The documentation on this isn't very detailed. I'd like to know how to make this work, and if there's some other, more comprehensive resource to learn about the graphics view framework, besides the official documentation (which is excellent btw, but it would be great if there was a more detailed treatise on the subject). EDIT: Following badgerr's advice, I replaced item-pos() in DragScene::dropEvent() with item-scenePos(), now the drop event creates a new circle in the drop site, which is more or less what I wanted. But the original circle is still in place, and while the drag is in progress, the item doesn't follow the mouse cursor. The QGraphicsSceneDragDropEvent documentation says that pos() should return the cursor position in relation to the view that sent the event, which, unless I got it wrong, shouldn't be (0,0) all the time. Weird. I've read in a forum post that you can use QDrag::setPixMap() to show something during the drag, and in examples I've seen pictures being set as pixmaps, but how do I make the pixmap just like the graphics item I'm supposed to be dragging?

    Read the article

  • WPF Listbox - Empty List Display Message

    - by David Ward
    Can anyone suggest the best way to display a Textblock (with a text such as "List Empty") so that it's visibility is bound to the Items.Count. I have tried the following code and can't get it to work, so think that I must be doing it wrong. <ListBox x:Name="lstItems" ItemsSource="{Binding ListItems}"> </ListBox> <TextBlock Margin="4" FontStyle="Italic" FontSize="12" Text="List is empty" Visibility="Collapsed"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=lstItems, Path=Items.Count}" Value="0"> <Setter Property="Visibility" Value="Visible" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock>

    Read the article

  • scvmap, disco, xsd, wsdl, svcinfo and datasource files

    - by David Gray Wright
    We have a WEb Service named, let's say Foo. So there is a Foo.svc file and a code behind Foo.svc.cs. We add a silverlight project and wish to use the Foo.svc services so we add a Service Reference and call it's namespace FooBar. This creates the following files : Reference.cs Reference.svcmap Foo.xsd Foo.disco configuration.svcinfo Foo.wsdl Also various *.datasource files. Over time we update the Foo.svc and add more Web Services (methods and interfaces) and the number of files in the FooBar directory is growing. I have 26 Foo(nn).xsd files in this directory - where nn = 1 to 26. My configuration.svcinfo is upto configuration91.svcinfo. My question is this? Do any of these files need to be version controlled? Can they all be deleted each time you do a build \ deploy (as long as you do an update service reference)?

    Read the article

  • RadioButtonList confirm SelectedIndexChange

    - by Brian David Berman
    I have a RadioButtonList control and I would like to do a Javascript "confirm" when a user tries to change the index. Currently AutoPostBack is set to TRUE. I can, of course, just call __doPostBack from within a javascript function, etc. I tried a few things with jQuery but you have to worry about mousedown vs. click and then there is always the fact that you can click the checkbox label to select it, etc. Anyone have a nice solution for this? To be clear, I am looking for a way to prompt the user with a confirm box prior to their selection being made and triggering a postback.

    Read the article

  • Silverlight TabControl - Finding and selecting a TabItem from a given Control in the TabItem.

    - by David Gray Wright
    I am building a LOB application that has a main section and a TabControl with various TabItems in it. On hitting save the idea is that any fields in error are highlighted and the first field in error gets the focus. If the first, and only, field in error is on an Unselected tab the tab should then become selected and the field in error should become highlighted and have focus. But I can not get this to work. What appears to be happening is that the Unselected tab is not in the visual tree so you can't navigate back to the owning TabItem and make it the currently selected TabItem in the TabControl. Has anyone got an idea on how this can be done\achieved?

    Read the article

  • C# - setting a property by reflection with a string value

    - by David Hodgson
    Hi, I'd like to set a property of an object through reflection, with a value of type string. So, for instance, suppose I have a Ship class, with a property of Latitude, which is a double. Here's what I'd like to do: Ship ship = new Ship(); string value = "5.5"; PropertyInfo propertyInfo = ship.GetType().GetProperty("Latitude"); propertyInfo.SetValue(ship, value, null); As is, this throws an Argument exception (Object of type 'System.String' cannot be converted to type 'System.Double'). How can I convert value to the proper type, based on propertyInfo?

    Read the article

  • Java Regular Expressions

    - by david robers
    Hi All, Im struggling to understand the regex documentation. How would I find the strings that contain exactly one C in the following text: ABCCAMNL YOOBABCCA XNABCCA ZDXUABCCA TAQABCC ISABCCA REABCCA CABCAMONPT Edit: private void matchIt(String regex, ArrayList<String> d) { Pattern p = Pattern.compile("[\\w^C]"); Matcher m = p.matcher(regex); for (int i = 0; i < d.size(); i++) { p.matcher(d.get(i)); if(m.find()){ out.println(d.get(i)); } } } i have the above function and it only outputs: ABCCAMNL YOOBABCCA Why is that?

    Read the article

  • NULL value when using NSDateFormatter after setting NSDate property via XML parsing

    - by David A Gibson
    Hello, I am using the following code to try and display in a time in a table cell. TimeSlot *timeSlot = [timeSlots objectAtIndex:indexPath.row]; NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init]; [timeFormat setDateFormat:@"HH:mm:ss"]; NSLog(@"Time: %@", timeSlot.time); NSDate *mydate = timeSlot.time; NSLog(@"Time: %@", mydate); NSString *theTime = [timeFormat stringFromDate:mydate]; NSLog(@"Time: %@", theTime); The log output is this: 2010-04-14 10:23:54.626 MyApp[1080:207] Time: 2010-04-14T10:23:54 2010-04-14 10:23:54.627 MyApp[1080:207] Time: 2010-04-14T10:23:54 2010-04-14 10:23:54.627 MyApp[1080:207] Time: (null) I am new to developing for the iPhone and as it all compiles with no errors or warnings I am at a loss as to why I am getting NULL in the log. Is there anything wrong with this code? Thanks Further Info I used the code exactly from your answer lugte098 just to check and I was getting dates which leads me to believe that my TimeSlot class can't have a date correctly set in it's NSDate property. So my question becomes - how from XML do I set a NSDate property? I have this code (abbreviated): -(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *) string { if ([currentElement isEqualToString:@"Time"]) { currentTimeSlot.time = string } } Thanks

    Read the article

  • Lucene numDocs and doqFreq on custom similarity class

    - by David A
    Hi All, im doing an aplication with Lucene (im a noob with it) and im facing some problems. My aplication uses the Lucene 2.4.0 library with a custom similaraty implementation (the jar is imported) In my app im calculating doqFreq and numDocs manually (im adding the values of all indexes and then i calculate a global value in order to use it on every query) and i want to use that values on a custom similarity implementation in order to calculate a new IDF. The problem is that I dont know how to use (or send) the new doqFreq and numDocs values from my app on that new similarty implementation as I dont want to change lucene´s code apart from this extra class. Any suggestions or examples? I read the docs but i dont now how to aproach this :s Thanks

    Read the article

  • PHP Curl's Proxy feature causes no information to be returned

    - by Grant David Bachman
    I'm working on a PHP script right now which sends requests to our school's servers to get real-time information about class sizes for different courses. The script runs perfectly fine when I don't use a proxy, returning a string full of course numbers and available seats. However, I want to make this a service for the students, and I'm afraid that if I make too many requests my ip will get blocked. So I'm attempting to do this through a proxy, with no success. As soon as I add the CURLOPT_HTTPPROXYTUNNEL and CURLOPT_PROXY fields to my requests nothing gets returned. I'm not even sure how to troubleshoot it at this point since I'm not getting an error message of any kind. Does anyone know what's going on or how to at least troubleshoot it?

    Read the article

  • Very Slow WebResponse triggering TimeOut

    - by David Fdez
    Hello: I have a function in C# that fetches the status of Internet by retrieving a 64b XML from the router page public bool isOn() { HttpWebRequest hwebRequest = (HttpWebRequest)WebRequest.Create("http://" + this.routerIp + "/top_conn.xml"); hwebRequest.Timeout = 500; HttpWebResponse hWebResponse = (HttpWebResponse)hwebRequest.GetResponse(); XmlTextReader oXmlReader = new XmlTextReader(hWebResponse.GetResponseStream()); string value; while (oXmlReader.Read()) { value = oXmlReader.Value; if (value.Trim() != ""){ return !value.Substring(value.IndexOf("=") + 1, 1).Equals("0"); } } return false; } using Mozilla Firefox 3.5 & FireBug addon i guessed it normally takes 30ms to retrieve the page however at the very huge 500ms limit it stills reach it often. How can I dramatically improve the performance? Thanks in advance

    Read the article

  • Windows Azure DownloadtoStream EOF error

    - by david
    Hello, I've been using Windows Azure to create a document management system, and things have gone well so far. I've been able to upload and download files to the BLOB storage through an asp.net front end. What I'm attempting to do now is allow users to upload a .zip file, and then take the files out of that .zip and save them as individual files. Problem is, I'm getting "ZipException was unhandled" "EOF in header" and I don't know why. I'm using the ICSharpCode.SharpZipLib library which I've used for many other tasks and its worked great. Here's the basic code: CloudBlob ZipFile = container.GetBlobReference(blobURI); MemoryStream MemStream = new MemoryStream(); ZipFile.DownloadToStream(MemStream); .... while ((theEntry = zipInput.GetNextEntry()) != null) and it's on the line that starts with while that I get the error. I added a sleep duration of 10 seconds just to make sure enough time had gone by. MemStream has a length if I debug it, but the zipInput does sometimes, but not always. It always fails. Thanks for any help. Dave

    Read the article

  • Using regexkitlite with strings containing % signs

    - by David Liu
    So I'm using RegexKitLite in my iPhone app, and I'm basically grabbing out a bunch of URLs and names from within a web page. The problem is that whenever it comes across a URL with URL encoded characters like %22 for a double quote or %27 for a single quote, the captured string basically gives me a jumbled overflowed string, containing garbage and even method names. I'm really not doing anything particularly special within the regex, just your basic "startdelimiter(.*)enddelimiter" regex.

    Read the article

  • How to use RadSpell within a Telerik MVC Grid editor popup?

    - by Brian David Berman
    Is it possible to use RadSpell within a Telerik MVC Grid editor popup? I have followed some of the examples online to use RadSpell with ASP.NET MVC (http://www.telerik.com/help/aspnet-ajax/mvc-using-spellchecker.html and http://www.telerik.com/help/aspnet-ajax/spell-client-side-api.html) and I am able to attach multiple text controls to check but the display gets messed up when using Telerik MVC Grid editor popups since it's already in a modal. Sometimes it will randomly pick another div on the page and treats it like it's the main window (it will gray out just a portion of the page and I'll see the RadSpell popup peeking through but it's unusable). It seems like it chooses different places in the DOM to inject the iframe/radwindow for RadSpell as well. Any ideas? I didn't include any code because my implementation is a mess and I'd prefer to start with something simpler, from scratch.

    Read the article

  • o3d javascript uncaught reference error

    - by David Menard
    hey, im new to javascript and am intersted in creating a small o3d script: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test Game Website</title> </head> <body> <script type="text/javascript" src="o3djs/base.js"></script> <script type = "text/javascript" id="myscript"> o3djs.require('o3djs.camera'); window.onload = init; function init(){ document.write("jkjewfjnwle"); } </script> <div align="background"> <div id="game_container" style="margin: 0px auto; clear: both; background-image: url('./tmp.png'); width: 800px; height:600px; padding: 0px; background-repeat: no-repeat; padding-top: 1px;"></div> </div> </body> </html> the browser cant seem to find o3djs/base.js in this line <script type="text/javascript" src="o3djs/base.js"></script> and gives me an uncaught referenceerror at this line o3djs.require('o3djs.camera'); Obviously, because it can't find the o3djs/base.js... I have installed the o3d pluggin from google and they say that should be IT ive tried on firefox, ie and chrome thanks

    Read the article

  • WPF Datagrid zoom issue

    - by David Osborn
    I'm working with the WPF DataGrid from the WPFToolkit and I'm having issues with trying to zoom the entire datagrid. My initial thought was that it was going to be really easy and I would just apply a scale transform to the grid and animate the ScaleX, ScaleY properties when the used clicked a button. This did not work however because the scrollbar was zoomed in making it larger. I need fixed headers and fixed columns on the datagrid so I can't simple use a scrollviewer outside of the datagrid to handle the scrolling. The second thing I tried was to just scale the font size in the grid, but this failed because on shrinking the font size the columns stay at the original width and do not shrink. Finally I thought I had it working by using the below code which goes into the view tree for the datagrid and adds a scale transform to the Scroll Content Presenter. (Also not shown in this code, I apply a transform to the visual tree item for the headers in the same manner so that it scales as well). I thought this was working great until I tested out the horizontal scrolling after zooming. (Vertical scrolling works perfectly.) Before zooming at all the horizontal scrolling is fine, but after zooming, when I scroll horzonitally the display freaks out. It is hard to tell exactly what it is doing, but it sort of looks like the content that is scrolling off the left of the screen is "folding over" and coming back in on the left. Maybe it is just all smashing up on the left side. Does anyone have any ideas how I can get this working, hopefully without throwing out my whole datagrid that is already working quite well otherwise. ScrollContentPresenter sp = (ScrollContentPresenter) VisualTreeHelper.GetChild( VisualTreeHelper.GetChild( VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(dgMatrix, 0), 0), 0),2); ScaleTransform st = new ScaleTransform(1, 1); sp.LayoutTransform = st; DoubleAnimation a = new DoubleAnimation(); a.By = 1.5; a.AutoReverse = false; a.Duration = new Duration(TimeSpan.Parse("0:0:0.25")); st.BeginAnimation(ScaleTransform.ScaleXProperty, a); st.BeginAnimation(ScaleTransform.ScaleYProperty, a);

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >