Search Results

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

Page 109/239 | < Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >

  • How to trigger binding source update from code in WPF?

    - by Benny
    In My ViewModel class I have a property: class ViewModel { public string FileName {get;set;} } and in my View I bind a label's content to ViewModel's FileName. now When I do drag-drop a file to my View, How can I update the label's Content property, so that the ViewMode's FileName also get updated via binding? Directly set the label's Content property won't work, it just simply clear the binding.

    Read the article

  • WPF: How to connect to a sql ce 3.5 database with ADO.NET?

    - by EV
    Hi, I'm trying to write an application that has two DataGrids - the first one displays customers and the second one selected customer's records. I have generated the ADO.NET Entity Model and the connection property are set in App.config file. Now I want to populate the datagrids with the data from sql ce 3.5 database which does not support LINQ-TO-SQL. I used this code for the first datagrid in code behind: CompanyDBEntities db; private void Window_Loaded(object sender, RoutedEventArgs e) { db = new CompanyDBEntities(); ObjectQuery<Employees> departmentQuery = db.Employees; try { // lpgrid is the name of the first datagrid this.lpgrid.ItemsSource = departmentQuery; } catch (Exception ex) { MessageBox.Show(ex.Message); } However, the datagrid is empty although there are records in a database. It would also be better to use it in MVVM pattern but I'm not sure how does the ado.net and MVVM work together and if it is even possible to use them like that. Could anyone help? Thanks in advance.

    Read the article

  • Close WPF PopUp when clicking on Window Title bar.

    - by Jobi Joy
    I can see that the PopUp dropdown of a combobox gets closed if we click anywhere else in the app. How do I give that feature to my own Popup. I dont want to give a PreviewMouseDown event handler for the RootWindow to solve this issue. Something at the level of my userControl containing this popup.

    Read the article

  • Hot to declare itemTemplate that has Itemsource as Enum Values in WPF?

    - by Ashish Ashu
    I have a enum let's say Enum MyEnum { FirstImage, SecondImage, ThirdImage, FourthImage }; I have binded this Enum to my combobox in XAML. While defining an combobox I have defined an ItemTemplate of combox to take Two UI element: TextBlock that show the enum value (Description) Image I have done this much in XAML. I am wondering where I can specify the Image corrosponding to each item of Enum. Is that possible through data trigger ? I really appreciate if anyone have the XAML for this scenario. Many Thanks in advance

    Read the article

  • Beginner WPF/XML question: How to get an <element> in an <element>?

    - by Niels
    I have a rather simple question. I'm trying to get information out of an XML file, and now I need to get the that's inside another This is my XML code: <author> <name>Random_name1 (Random Name)</name> <uri>http://thisisanrandomurl.com</uri> </author> I can get the info with this code: Name = item.Element(ns + "author").Value, But this gives me: "Random_name1 (Random Name) http://thisisanrandomurl.com" I only want the info inside the tags. Any ideas? Thanks a lot, - Niels

    Read the article

  • How do I keep the shape of an UIELement while doing a Drag and Drop in WPF

    - by Kamikaze
    Hi all!I'll give an example of what I intend to do: I have 2 StackPanels one containing an Ellipse the other one containing nothing; I want to drag the Ellipse from one stack panel to the other . The actual drag & drop is already done and works fine. However I'd like to know how to keep that that Ellipse shape at the tip of my mouse cursor (I've been searching all day and couldn't find anything that helps ) Even an windows forms example would be nice , I'll be able to adapt it :). Thanks for the help!

    Read the article

  • How can I model the data in a multi-language data editor in WPF with MVVM?

    - by Patrick Szalapski
    Are there any good practices to follow when designing a model/ViewModel to represent data in an app that will view/edit that data in multiple languages? Our top-level class--let's call it Course--contains several collection properties, say Books and TopicsCovered, which each might have a collection property among its data. For example, the data needs to represent course1.Books.First().Title in different languages, and course1.TopicsCovered.First().Name in different languages. We want a app that can edit any of the data for one given course in any of the available languages--as well as edit non-language-specific data, perhaps the Author of a Book (i.e. course1.Books.First().Author). We are having trouble figuring out how best to set up the model to enable binding in the XAML view. For example, do we replace (in the single-language model) each String with a collection of LanguageSpecificString instances? So to get the author in the current language: course1.Books.First().Author.Where(Function(a) a.Language = CurrentLanguage).SingleOrDefault If we do that, we cannot easily bind to any value in one given language, only to the collection of language values such as in an ItemsControl. <TextBox Text={Binding Author.???} /> <!-- no way to bind to the current language author --> Do we replace the top-level Course class with a collection of language-specific Courses? So to get the author in the current language: course1.GetLanguage(CurrentLanguage).Books.First.Author If we do that, we can only easily work with one language at a time; we might want a view to show one language and let the user edit the other. <TextBox Text={Binding Author} /> <!-- good --> <TextBlock Text={Binding ??? } /> <!-- no way to bind to the other language author --> Also, that has the disadvantage of not representing language-neutral data as such; every property (such as Author) would seem to be in multiple languages. Even non-string properties would be in multiple languages. Is there an option in between those two? Is there another way that we aren't thinking of? I realize this is somewhat vague, but it would seem to be a somewhat common problem to design for. Note: This is not a question about providing a multilingual UI, but rather about actually editing multi-language data in a flexible way.

    Read the article

  • how to extend wpf combo box to bind data?

    - by Shaihan
    i need to bind a collection of objects to a combo box which i can use in different forms. so i want create a custom control which binds the collection to the combo box? how t do it by extending combo box? also how can i define the ItemData template?

    Read the article

  • Tool to generate a GUI (WinForms or WPF) from a class.

    - by Pat
    Say we've got a class like public class Doer { public int Timeout {get;set;} public string DoIt(string input) { string toReturn; // Do something that involves a Timeout return toReturn; } } Is there a tool that would create a Form or Control for prototyping this class? The GUI might have a NumericUpDown control with a label of "Timeout" and a GroupBox with a TextBox for "input" and a button labeled "DoIt" with an eventhandler that calls Doer.DoIt with the Text property of the input TextBox and puts the response in another TextBox.

    Read the article

  • How do I implement a custom Brush in WPF?

    - by MojoFilter
    Where can I find out enough info about how Brushes work to implement my own System.Windows.Media.Brush? I can handle all of the freezable baggage, but it's not really obvious what I need to override to get it to work. Yeah, so I didn't mean that I want to use a predefined brush. I want to extend System.Windows.Media.Brush, which is an abstract class. This is all purely for my own edification. I'm not even sure what kind of brush I could make. I was just trying to learn how brushes work. As in: public AwesomeBrush : Brush { protected override Freezable CreateInstanceCore() { return new AwesomeBrush(); } ... // concrete brush stuff }

    Read the article

  • How to find out minimal render size of a visual in WPF?

    - by MartyIX
    Hello, I'm trying to display a game desk and info panel right next to the game desk and I need to calculate minimal width of the info panel in order to display the game desk properly. This is my XAML code: <StackPanel Orientation="Horizontal"> <Rectangle Width="Auto" Height="Auto" Name="gamedeskRect" Style="{DynamicResource GameDesk}" /> <StackPanel Name="infoPanel" Width="Auto" HorizontalAlignment="Right" Height="Auto" VerticalAlignment="Center" Margin="10,0,0,0"> <!-- a few textblocks in a grid here --> </StackPanel> </StackPanel> And the problem is that when I'm resizing the window a part of the right panel may be cropped which is what I don't want.

    Read the article

  • In a WPF Application, What happens after my code in the main window constructor is executed?

    - by KyleGobel
    I'm wondering what happens after the constructor is done executing my code, because the constructor is taking like 10 seconds to run on a cold start up, but according to the profiler, my code is done executing in like 2 seconds. Also stepping through the code in the debugger, after the last line of my constructor, I sit there and wait for 7-8 seconds before the window appears. Why is this? If the window is loading content or something, why isn't it displayed on the screen, done loading or not after the constructor finishes it's job? What's the hold up? (or how do i figure that out)

    Read the article

  • WPF Binding with RelativeSource of Window Requires "DataContext" in Path?

    - by Phil Sandler
    The following code works, but I'm curious as to why I need the Path to be prefixed with "DataContext"? In most other cases, the path used is relative to DataContext. Is it because I am using a RelativeSource? Because the source is at the root level (Window)? <Style TargetType="TextBox"> <Setter Property="IsReadOnly" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.IsReadOnly}"/> </Style>

    Read the article

  • WPF/MVVM: Reshaping/Binding data on a DataGrid to a PivotGrid layout ?

    - by msfanboy
    Hello, I do not want to use 3rd party controls because I would have to buy a suite for justing using one control... So is there any chance I can arrange 3 entities: Subject, Grade and Pupil in that way on a simple DataGrid to show Pivot data like: ...........Math....Sports.... M.Kramer...A.......C......... B.Jonson...D.......A......... Does the binding for example work on the RowHeader with properties of a custom object/entity ? And would sorting destroy the whole relations between the entities ? You ever tried to do something like that?

    Read the article

  • How can I bind a instance of a custom class to a WPF TreeListView without bugs?

    - by user327104
    First, from : http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx I get a nice TreeListView. I left the original classes (TreeListView, TreeListItemView, and LevelToIndentConverter) intact, the only code y have Added is on the XAML, here is it: <Style TargetType="{x:Type l:TreeListViewItem}"> .... </ControlTemplate.Triggers> <ControlTemplate.Resources> <HierarchicalDataTemplate DataType="{x:Type local:FileInfo}" ItemsSource="{Binding Childs}"> </HierarchicalDataTemplate> </ControlTemplate.Resources> </ControlTemplate> ... here is my custom class public class FileInfo { private List<FileInfo> childs; public FileInfo() { childs = new List<FileInfo>(); } public bool IsExpanded { get; set; } public bool IsSelected { get; set; } public List<FileInfo> Childs { get { return childs; } set { } } public string FileName { get; set; } public string Size { get; set; } } And before I use my custom class I remove all the items inside the treeListView1: <l:TreeListView> <l:TreeListView.Columns> <GridViewColumn Header="Name" CellTemplate="{StaticResource CellTemplate_Name}" /> <GridViewColumn Header="IsAbstract" DisplayMemberBinding="{Binding IsAbstract}" Width="60" /> <GridViewColumn Header="Namespace" DisplayMemberBinding="{Binding Namespace}" /> </l:TreeListView.Columns> </l:TreeListView> So finaly I add this code to bind a Instance of my class to the TreeListView: private void Window_Loaded(object sender,RoutedEventArgs e) { FileInfo root = new FileInfo() { FileName = "mis hojos", Size="asdf" }; root.Childs.Add(new FileInfo(){FileName="sub", Size="123456" }); treeListView1.Items.Add(root); root.Childs[0].Childs.Add(new FileInfo() { FileName = "asdf" }); root.Childs[0].IsExpanded = true; } So the bug is that the button to expand the elementes dont appear and when a node is expanded by doble click the child nodes dont look like child nodes. Please F1 F1 F1 F1 F1 F1 F1 F1.

    Read the article

  • C# WPF: Combobox isn't jumping down the list as I type when I use a multiconvert on it.

    - by michael paul
    Basically, I have a combobox that is built by doing multibinding (multiconverter) for the memberdisplaypath. The problem is if the combobox is selected and I start typing, it doesn't jump down the list. Doesn't it go by what's displayed in the combobox for typing? That is, if the combobox is setup like so: //value/display (please disregard how weird the numbering is...) //ref - the value is built upon an observablecollection of a class. ref / "" ref / "10 - Very much agree." ref / "15 - Somewhat agree." ref / "19 - No weight." ref / "23 - Somwhat disagree." ref / "33 - Very much disagree." If the user presses the "1" key it should jump to "10 - Very much agree." But, instead it just sits there...

    Read the article

  • How do I assign selected WPF datagrid row columns to variables. (VB.NET)

    - by Peter
    Hi, I have a datagrid with customer data such as ID, name, email, phone etc. When I select a row (with a button or selectionchanged) I want to store that row's columns in variables like dim email as string dim name as string email = dgCustomers.theselectedrow.theselectedcell name = dgCustomers.theselectedrow.theselectedcell If I have a datatable with only one row I know I can get column data with: dim email as string = CustomerDataTableInstance.rows(0).Item("Email") I don't know how to get the selected row number though when I have several rows and the user clicks one/uses the keyboard. The datagrid is bound to a datatable, not a class with object collections. Any help is appreciated!

    Read the article

  • WPF: ContextMenu item bound to a Command is enabled only after invoking the command from another so

    - by Brad
    I have a ContextMenu whose items are all bound to commands and enable\disable correctly after ANY Command is invoked from another source but prior to, they are all disabled. So if I run the app, all the MenuItems are disabled but if I invoke any of the bound commands from another source (buttons, for instance) they become synchronized with the CanExecute code. I have no idea how to debug this. Any thought would be helpful!?!

    Read the article

  • What causes a WPF ListCollectionView that uses custom sorting to re-sort its items?

    - by Drew Noakes
    Consider this code (type names genericised for the purposes of example): // Bound to ListBox.ItemsSource _items = new ObservableCollection<Item>(); // ...Items are added here ... // Specify custom IComparer for this collection view _itemsView = CollectionViewSource.GetDefaultView(_items) ((ListCollectionView)_itemsView).CustomSort = new ItemComparer(); When I set CustomSort, the collection is sorted as I expect. However I require the data to re-sort itself at runtime in response to the changing of the properties on Item. The Item class derives from INotifyPropertyChanged and I know that the property fires correctly as my data template updates the values on screen, only the sorting logic is not being called. I have also tried raising INotifyPropertyChanged.PropertyChanged passing an empty string, to see if a generic notification would cause the sorting to be initiated. No bananas. EDIT In response to Kent's suggestion I thought I'd point out that sorting the items using this has the same result, namely that the collection sorts once but does not re-sort as the data changes: _itemsView.SortDescriptions.Add( new SortDescription("PropertyName", ListSortDirection.Ascending));

    Read the article

< Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >