Search Results

Search found 5961 results on 239 pages for 'wpf 4 5'.

Page 131/239 | < Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >

  • Change binding value, not binding itself

    - by Sam
    I've got a WPF UserControl containing a DependencyProperty (MyProperty). The DependencyProperty is bound to a Property in the DataContext. Now in the UserControl I want to change the value of the bound property. But if I assign MyProperty = NewValue the Binding is lost and replaced by NewValue. What I want to achieve is change the DataContext-property the DependencyProperty is bound to. How do I achieve this instead of changing the binding? To clarify: using something like MyTextBox.Text = "0"; I'll release the binding. How would I set Text, leave the binding intact so the property Text is bound to will change, too.

    Read the article

  • Refresh/Reset View

    - by Jay
    Hi, I'm using MVP in WPF and I came across a design doubt and I would to get your opinion on this: At some point I need to refresh my view and perform the same initial queries, like when the view was loading. The view's DataContext is my presenter and I have a couple of collections and other variables that are bound to the view. When I need to refresh the view, I'm clearing the collections and the variables and setting the DataContext to null. After that I fetch new data, populate the collections and set the DataContext. Is this the best way to achieve this? The issue with this, is that i'm affraid that when my app grows bigger I forget to reset some variable...the ideal would be to reload the view again in some way without having to worry with the variables I have. Best regards.

    Read the article

  • What are the real-world benefits of declarative-UI languages such as XAML and QML?

    - by Stu Mackellar
    I'm currently evaluating QtQuick (Qt User Interface Creation Kit) which will be released as part of Qt 4.7. QML is the JavaScript-based declarative language behind QtQuick. It seems to be a very powerful concept, but I'm wondering if anybody that's made extensive use of other, more mature declarative-UI languages like XAML in WPF or Silverlight can give any insight into the real-world benefits that can be gained from this style of programming. Various advantages are often cited: Speed of development Forces separation between presentation and logic Better integration between coders and designers UI changes don't require re-compilation Also, are there any downsides? A few potential areas of concern spring to mind: Execution speed Memory usage Added complexity Are there any other considerations that should be taken into account?

    Read the article

  • Add new row: ListView vs. DataGrid

    - by Shimmy
    Hello! I have been looking around and even found a couple of related answers and didn't get a certain answer to my question. Is there a way to have in the WPF ListView an additional row like in a DataGrid? I prefer using the ListView since I use 3.5 and the DataGrid is not officially in the box and has many quirks. I would prefer using the ListView if there is an official option to add new rows or else I use the DataGrid. Thanks a lot.

    Read the article

  • ScrollBars are not visible after changing positions of controls inside a Canvas

    - by akjoshi
    Hi, I created a custom canvas control inheriting from WPF Canvas. I am using it like this in main window - <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <RTD:RTDesignerCanvas Margin="5" Background="White" x:Name="canvas1" Focusable="True" AllowDrop="True"> </RTD:RTDesignerCanvas> </ScrollViewer> Everyhting works fine but when I try to set the position of controls inside it like this Canvas.SetTop(item, 200); scrollbars are not visible and control is hiddedn down somewhere. Intrestingly, if I add another control to it scroll bars are visible and I can scroll downwards to see the previous control. I tried to use base.InvalidateVisual(); base.UpdateLayout(); base.InvalidateArrange(); after changing items Top or Left but nothing happens; Am I missing something or this happens due to some bug?

    Read the article

  • TreeView Databinding

    - by Anu
    Hi,I want to add items in treeviewi n WPF.I have function as public void SetTree(string Title,int Boxtype,int BoxNo ) { sBoxType = "Group"; TreeList items = TreeList.Load(Title, sBoxType, BoxNo); DataContext = items; } XAML Code of TreeView: <TreeView Margin="16,275,18,312" x:Name="treeView1" ItemsSource="{Binding}" ItemTemplate="{StaticResource TreeItemTemplate}"> </TreeView> <DataTemplate x:Key="TreeItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path=Title}" /> <TextBlock Text="{Binding Path=Box}" /> </WrapPanel> </DataTemplate> Actually i wan to TreeView ot display lik +Group (header) Controllersgroup 5 (Child items). As multicolumn child items.But it dislay like Controllersgroup5

    Read the article

  • Batch scripting for directories or better method

    - by baron
    Hi Everyone, Looking at creating a simple batch file for my app. My app needs some directories to be in place as it runs. The first method I thought was just make a batch script: @ECHO OFF IF NOT EXIST C:\App GOTO :CREATE ELSE GOTO :DONTCREATE :CREATE MKDIR C:\App\Code ECHO DIRECTORY CREATED :DONTCREATE ECHO IT WAS ALREADY THERE 1) This doesn't run as I would expect. Both :CREATE and :DONTCREATE seem to run regardless? How do I do an If properly then? Output: A subdirectory or file C:\App\Code already exists. DIRECTORY CREATED IT WAS ALREADY THERE So it enters both true and false statements? 2) The app is a C# WPF app. For what I am trying to do here (create a couple of directories if they don't already exist) - should I do it some other way? Perhaps in the application as it runs?

    Read the article

  • MVVM Light toolkit - maintained? Here today - gone tomorrow? ...

    - by mark smith
    Hi there, I have been taking a look at mvvm light toolkit, i must admit i haven't got a lot of experience with it but i live what i see.. I did use the mvvm toolkit (microsoft) but currently use vs 2010 and no templates are available as yet. I was looking for some insight into mvvm light toolkit... Is it always maintained ? i..e its not going to be gone tomorrow... Or shoudl i be looking elsewhere?? I would really appreciate any feedback... I also saw some info on how it is blendable which the mvvm toolkit (microsoft) didn't seem to have.. Prism also seems to be also a likely candidate but from what i understand its not a MVVM framework / toolkit i would be using it with wpf Any help really appreciated Thank you

    Read the article

  • DateTime Property not firing PropertyChanged event when changed

    - by Brent
    I'm working on a WPF MVVM application and I've got a TextBox on my view that is bound to a DateTime property on the ViewModel. Seems simple enough, but when I clear the text in the TextBox, the property never changes. In fact, it never even fires until I begin typing "4/1..." and then it fires. What can I do to fix this? Obviously I could bind the TextBox to a string property and then update the real property in the setter, but that's a bit of a hack. There's got to be a better way... ViewModel private DateTime _startDate; public DateTime StartDate { get { return _startDate; } set { _startDate = value; OnPropertyChanged("StartDate"); } } View <TextBox Text="{Binding Path=StartDate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=true}"/>

    Read the article

  • YesNo MessageBox not closing when x-button clicked

    - by Simpzon
    When I open a MessageBox with options YesNo, the (usually) cancelling cross in the upper right is shown but has no effect. System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNo); If I offer YesNoCancel as options, clicking the cross closes the Dialog with DialogResult Cancel. System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNoCancel); I would have expected that the cross is "looking disabled" if not hidden at all, when clicking it has no effect. Probably I am not the first one observing this. What is your favorite way to hide/disable this button or workaround the issue? Note: I would prefer a solution that does not use System.Windows.Forms, since I am dealing with WPF projects and would like to avoid any InterOp if possible.

    Read the article

  • How to implement an override method in IronPython

    - by Adal
    I'm trying to implement a WPF control in IronPython and I'm having trouble implemented the override methods. The code below fails with this error: TypeError: expected int, got instancemethod. If I rename the VisualChildrenCount method, the exception is not raised anymore, but the control doesn't work. So how do I tell IronPython that the method is an override? class PaintCanvas(FrameworkElement): def __init__(self): self.__children = VisualCollection(self) dv = DrawingVisual() self.__children.Add(dv) # In C# this should be: protected override int VisualChildrenCount def VisualChildrenCount(self): return self.__children.Count # In C# this should be: protected override Visual GetVisualChild(int index) def GetVisualChild(self, index): return self.__children[index]

    Read the article

  • SelectedIndex of combobox not updating correctly using databinding.

    - by Matthijs Wessels
    I have a ComboBox: <ComboBox Name="iComponentFieldComboBox" SelectedIndex="{Binding ComponentFieldSelectedIndex, Mode=TwoWay}" Height="23" Margin="132,0,280,38" VerticalAlignment="Bottom"> <ComboBoxItem Name="item1">item1</ComboBoxItem> <ComboBoxItem Name="item2">item2</ComboBoxItem> <ComboBoxItem Name="item3">item3</ComboBoxItem> </ComboBox> When I start my WPF and set the ComponentFieldSelectedIndex property of my ViewModel in my code, nothing happens. But after I have selected an item in the combobox, then suddenly setting ComponentFieldSelectedIndex does work. for example: start app. click button that sets ComponentFieldSelectedIndex to 1. selected item doesn't change to item2. select item3 in combo box. click button that sets ComponentFieldSelectedIndex to 1. selected item does change to item2. Does anyone have an idea what could be causing this?

    Read the article

  • Graphical net and text

    - by chesheerkys
    Hello! My task is to make a control, that behaves itself like RichTextBox, but contains a graphical net. The only task, this net is solving, is to be visible. It should be solution in overriding OnPaint method, but it doesn't. This code: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); ...//drawing a line } gives me RichTextBox without of text This code: protected override void WndProc(ref System.Windows.Forms.Message m) { base.WndProc(ref m); if (m.Msg == 15) { Graphics g = this.CreateGraphics(); g.DrawLine(new Pen(Color.White, 1), new Point(0, 0), new Point(400, 400)); } } sometimes draws extra lines Actually since these two ways don't work, I don't know what to try. Waiting for your advices :) BR Dmitry P.S. I’ve heard a lot about great opportunities of WPF, but I’m not really common with this technology and don’t know what to start with. P.P.S. Sorry for my English, it’s not my natural language.

    Read the article

  • Whats wrong with my backgroundwork method

    - by diver-d
    I am trying to get a background worker process working in a wpf application. it creates 2 files then crashes. BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += delegate(object s, DoWorkEventArgs args) { CreateFile(i.ToString()); }; worker.RunWorkerAsync(); private void CreateFile(string fileName) { string path = string.Format(@"{0}\{1}.txt", directory, fileName); using (StreamWriter sw = new StreamWriter(path)) { sw.WriteLine(fileName); } } I get this error " The requested operation cannot be performed on a file with a user-mapped section open." what am I doing wrong? Any help would be great

    Read the article

  • Dynamic size canvas with Scroll bars

    - by Pawan
    Hi, I am developing a simple WPF application without any auto layout. The goal is when a user clicks (mouse down) a element (say textBlock) will appear at the location of the mouse click. For this I am using canvas panel embedded in a Grid of 1 row, 1 column and scrollviewer (visible). The issues are: 1. when the application window is resized the scroll viewers do not become active. 2. I want the ability to auto grow the canvas with mouse drag. Something like in MS-Excel when user drags the mouse horizontally/vertically the canvas should grow. I have searched net a lot to figure this out and am unable to get an answer. Any help in this regard would be great. Thanks a bunch in advance. -P

    Read the article

  • Transpose a Collection

    - by Joseph Melettukunnel
    Hello, I've a list of different sizes of a T-Shirt, e.g. S, M, L. Since this might change for T-Shirts (sometimes we just have e.g. M, L), we load this into a List sizes. Since most DataGrids (xamDataGrid, WPF Toolkit DataGrid) need Properties for binding to the Columns, I'd like to transpose somehow my data. Does anyone have an idea how to do this? E.g. Instead of having List where Size { string sizeName, int available, int defect, int ordered} Avail. Defect Ordered [S] 1 2 3 [M] 1 2 3 [L] 1 2 3 I want an Object which has the Properties S, M, L containing the Values like this: [S] [M] [L] Avail. 1 2 3 Defect 1 2 3 Ordered 1 2 3 The problem here is that I don't know how many sizes will be available for the tshirt, it might be 3, 4, or 10. Thanks for any help Cheers PS: Here is a mockup of how the final grid should look like http://img39.imageshack.us/img39/9161/multirowspangridfixedel.png

    Read the article

  • Detecting a Key Press Squashed by Another Application

    - by Eric Smith
    I have a WPF application I'm planning to use as an overlay for a DirectX game (specifically Bad Company 2). I'm using WM_KEYBOARD_LL hook to detect KeyDown events so I can bring my app to the foreground when a specific button is pressed. This works perfectly except for when the game is running (I've also noticed this problem with Window's "Chess Titans" so it may be a DirectX thing). As far as I can work out, when the game detects a keyboard press, it "eats" the event and doesn't pass the CallNextHookEx() method like it should, which would allow the key press message to be moved along to the next application in the queue. I'm wondering if there's any sort of work-around to this? It seems kind of unfair that a single application can just willy-nilly eat up messages like that. Thanks! :) Relevant MSDN documentation: http://msdn.microsoft.com/en-us/library/ms644985%28VS.85%29.aspx

    Read the article

  • How apply a storyboard to a Label programmatically ?

    - by ThitoO
    Hi :), I've a little problem, I'd search google and my Wpf's books but I don't found any answer :( I have created a little storyboard : <Storyboard x:Key="whiteAnim" Duration="1"> <ColorAnimation By="Black" To="White" Storyboard.TargetProperty="Background" x:Name="step1"/> <ColorAnimation By="White" To="Black" Storyboard.TargetProperty="Background" x:Name="step2"/> </Storyboard> This animation will change background color from black to white, and from white to black. I want to "apply" this storyboard to a Label : Label label = new Label(); label.Content = "My label"; I'm looking for a method like "label.StartStoryboard(--myStoryboard--), do you have any ideas ? Thank you :)

    Read the article

  • Image Viewer application, Image processing with Display Data.

    - by Harsha
    Hello All, I am working on Image Viewer application and planning to build in WPF. My Image size are usually larger than 3000x3500. After searching for week, I got sample code from MSDN. But it is written in ATL COM. So I am planning to work and build the Image viewer as follows: After reading the Image I will scale down to my viewer size, viwer is around 1000x1000. Lets call this Image Data as Display Data. Once displaying this data, I will work only this Display data. For all Image processing operation, I will use this display data and when user choose to save the image, I will apply all the operation to original Image data. My question is, Is is ok to use Display data for showing and initial image processing operations.

    Read the article

  • Does performance even matter anymore? [closed]

    - by Jeff Dahmer
    The performance differences between C/C++ and C# are astounding. An ASP.NET page loads in 1/8 the time that a PHP script does haha.... WPF, aka " The Future ", (you know it will be, all the companies are gonna want cool looking desktop apps, don't kid yourself.) And it has huge performance hits just to start up. We've let Microsoft make us as developers lazy! Why do I hate this, it's such a good thing? Are we at a point in time where the majority of computers can handle this kinda crap? I remember when performance used to matter. Anyways, I'm writing a .NET library and ever since I found out LINQ is slower than traditional delegates which is slower than the normal procedural code... well it's a guilty evil I feel for every LINQ query I write, because they are so beautiful. Am I just too much of a performance stickler? Or just too big of a nerd?

    Read the article

  • Best way to hide a window from the Alt-Tab program switcher?

    - by chaiguy1337
    I've been a .NET developer for several years now and this is still one of those things I don't know how to do properly. It's easy to hide a window from the taskbar via a property in both Windows Forms and WPF, but as far as I can tell, this doesn't guarantee (or necessarily even affect) it being hidden from the Alt-Tab dialog. I've seen invisible windows show up in Alt-Tab, and I'm just wondering what is the best way to guarantee a window will never appear (visible or not) in the Alt-Tab dialog. Update: Please see my posted solution below. I'm not allowed to mark my own answers as the solution, but so far it's the only one that works. Update 2: There's now a proper solution by Franci Penov that looks pretty good, but haven't tried it out myself. Involves some Win32, but avoids the lame creation of off-screen windows.

    Read the article

  • Navingating to an .html file in the assembly

    - by Joel
    I’m working with the WPF WebBrowser control to navigate to a html page hosting Silverlight. It seems I cannot use the NavigateToString or NavigateToStream method since I have Silverlight content. The html content loads fine but not Silverlight. So I think I’ll have to use the Navigate method which takes an Uri. Now I html page I’d like to navigate to is in a .html file in my Visual Studio project so I will have to have a local uri of some sort. I don’t want the html file to be copied to the output folder since I don’t want to distribute it separately; I want it to be somehow included in the assembly. The problem is that the WebBrowser control doesn’t seem to allow relative Uris or pack://application: uris. How could I accomplish navingating to an .html file in the assembly?

    Read the article

  • How Can I Add a New Command to a Control's Event

    - by Chris
    Hi, thanks for taking a look at this question. I have been building an application (VB/WPF) following Josh Smith's example of an MVVM pattern: Click here to view My Views have Controls which trigger a Command upon an event, such as a button click and these are bound to properties in the ViewModel. My ViewModel exposes properties of type ICommand which invoke the appropriate methods. This has worked well, until now! I now want to use a Thumb Control to allow a user to move an object within a Canvas. I don't believe that the Thumb has a Command capability 'out of the box'. A Thumb raises a 'DragDelta' event when being moved. So my question is as follows: How do I extend a Control's capability to issue a Command upon an event please? I wish to issue a new Command, let's say 'onDragDelta' so that I can bind it to a property in my ViewModel just like my Buttons. Thank you very much

    Read the article

  • Strategy for unsubscribing event handlers

    - by stiank81
    In my WPF application I have a View that is given a ViewModel, and when given this View it adds event handlers to the ViewModel's PropertyChanged event. When some action occur in the GUI I remove the View and add another View to the holding container - where this new one is bound to the same ViewModel. After this has happened the old View still keeps handling PropertyChanged events in the ViewModel. I'm assuming this happens because the View hasn't been collected by the Garbage Collector yet, and therefore is alive? Well - I need it to stop. My assumption is that I need to manually detach the event handler from the ViewModel? Is there a best-practice on how to handle this?

    Read the article

  • Javascript resizing with window.open and WebBrowser control

    - by Raj
    I'm using WPF WebBrowser control and handling NewWindow3 events using following code: IServiceProvider serviceProvider = (IServiceProvider)webBrowser.Document; Guid serviceGuid = SID_SWebBrowserApp; Guid iid = typeof(SHDocVw.WebBrowser).GUID; SHDocVw.WebBrowser wb = (SHDocVw.WebBrowser)serviceProvider.QueryService(ref serviceGuid, ref iid); wb.NewWindow3 += new SHDocVw.DWebBrowserEvents2_NewWindow3EventHandler(wb_NewWindow3); How to handle javascript resizing when navigating using window.open, something like this: window.open('Sample.htm',null,'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no'); Is there anyway to get height and width requested by caller in NewWindow3 event handler?

    Read the article

< Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >