Search Results

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

Page 86/239 | < Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >

  • WPF Single Selection Across Multiple ItemsControls

    - by gregsdennis
    Part of my app has a month-view calendar interface, but I'm having trouble with item selection. The interface is set up so that each of the days in the view contains a ListBox of items, much like the month view in Outlook. The problem I'm experiencing is that I need to maintain a single item selection across all of the ListBoxes. Below is a sample window that should adequately describe my situation. I need to maintain a single selection between both ListBoxes. <Window x:Class="StackOverflow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <ListBox ItemsSource="{Binding Numbers}" SelectedItem="{Binding SelectedObject"/> <ListBox Grid.Column="1" ItemsSource="{Binding Dates}" SelectedItem="{Binding SelectedObject"/> </Grid> </Window> In this primitive example, I would expect that when the SelectedObject property of my view model gets set to an item that's not in one ListBox, the selection would be removed in that ListBox, but that doesn't happen. I understand that I can simply name each ListBox, and hook into the SelectionChanged event. I'd prefer to not have to do that with an entire month-view calendar. There has to be a better way. In a previous iteration of the app, I was able to create a SelectionManager static class with an attached property that was used to maintain selection. However, I can't use this now as the classes I'm using for my items are not DependencyObjects, and I'd really prefer not to have to create DependencyObject wrapper classes as this will considerably complicate my architecture. Thanks.

    Read the article

  • WPF Moving Element problem

    - by Kyle
    Hello, I am probably over-doing a very simple problem, but this is what I have a the moment: I have several buttons and a listbox of items in which the user can select and interact with. My application also moves those elements in accordance to the application width/height, such as follows: listBox1.Margin = new Thickness(this.ActualWidth * 0.84, this.ActualHeight * 0.3, 0, 0); I am able to select the items within the listbox and click on buttons appropriately while in windowed mode, but as I begin to stretch the application larger, I try to click on the items, and I cannot do so.. is this because I also need to update their hit-detection rectangles as well? Or perhaps am I moving the items incorrectly? I am at a loss.. any information would be very helpful at this point...thanks!

    Read the article

  • Event consumption in WPF

    - by webaloman
    I have a very simple app written in Silverlight for Windows Phone, where I try to use events. In my App.xaml.cs code behind I have implemented a GeoCoordinateWatcher which registers a gCWatche_PositionChanged method. This works ok, method is called after the position has been changed. What I want to do is fire an other event lets say DBUpdatedEvent after DB has been updated in the gCWatche_PositionChanged method. For this i delclared in the App.xaml.cs public delegate void DBUpdateEventHandler(object sender, EventArgs e); and I have in my App class: public event DBUpdateEventHandler DBUpdated; the event is fired like this in the end of gCWatche_PositionChanged method like this: OnDBUpdateEvent(new EventArgs()); and also I have declared : protected virtual void OnDBUpdateEvent(EventArgs e) { if (DBUpdated != null) { DBUpdated(this, e); } } Now I need to consume this event in my other Windows Phone app page which is a separate class PhoneApplicationPage. So I declared this method in this other Phone Page: public void DBHasBeenUpdated(object sender, EventArgs e) { Debug.WriteLine("DB UPDATE EVENT CATCHED"); } And in the constructor of this page I declared: DBUpdateEventHandler dbEH = new DBUpdateEventHandler(DBHasBeenUpdated); But when I test the application event is fired (OnDBUpdateEvent is called, but DBUpdated is null, therefore DBUpdated is not called - strange) and I have a problem that the other Phone Page is not catching the event at all... Any suggestions? How to catch that event. Thanks.

    Read the article

  • Custom Command WPF

    - by Sachin Gaur
    I have an application that contains Menu and sub menus. I have attached Appliocation Commands to some of the sub menu items such as Cut, Copy and Paste. I also have some other menu items that do not have application commands. How could I add a custom command binding to those sub menu items? I have gone through this artcile but unable to attach event to my sub menu items.

    Read the article

  • TreeView binding issue in WPF

    - by Michael Stoll
    Consider the following data structure: List<Person> People; class Person { List<Car> Cars; List<Hobby> Hobbies; } I want to bind a TreeView to this structure. And it should look like this: People > Frank > Cars > BMW > Ford > Hobbies > Tennis > Golf > Jane > Cars > Hobbies How can this be achieved in XAML? This is a follow up question to binding-a-treeview-with-contextmenu-in-xaml

    Read the article

  • WPF ListView Show selected item

    - by Jeffrey
    hi, i want to show the selected item in a list view automatically(it isn't possible to show all items without scrolling). this.listView.SelectedIndex = 999; selects of course an item, but it doesn't show it. what can i use to show it automatically ? kind regards, jeff

    Read the article

  • WPF InotifyPropertyChanged and view models

    - by Joel Barsotti
    So I think I'm doing something pretty basic. I know why this doesn't work, but it seems like there should be a straight foward way to make it work. code: private string fooImageRoot; // .... public BitmapImage FooImage { get { URI imageURI = new URI(Path.Combine(fooImageRoot, CurrentFooTypes.FooObject.FooImageName)); return imageURI; } } So CurrentFOoTypes and FooObject also supports INotifyPropertyChanged. So If I bind a TextBlock to CurrentFooTypes.FooObject.FooImageName, if either fooObject or FooImageName change the textblock updates. How can I subscribe my viewmodel object to recieve updates in a similiar fasion.

    Read the article

  • WPF: Best method for printing paginated datagrids

    - by FauxReal
    Boy did I get an education looking into this. I guess I've been spoiled by Powerbuilder, which has fantastic functionality for this out of the box. Does anyone seriously write custom documentpaginator objects to handle reporting needs for their LOB apps? I want to be able to print "for free" and not have to code like crazy just to take whats on the screen and throw it on paper. How are people doing this? Does anyone have a recommended 3rd party for allowing printing of largish datagrids? Thanks

    Read the article

  • Wpf application variable not changing

    - by Hasan Zubairi
    In my application I need some variables on almost all the pages so I declared them in Application.xaml like <sys:String x:key="First">First</sys:String> and on one page I change the value in code like Resources["First"] = "This is First"; on the second page when I call the variable like String f = (string)this.TryFindResource("First"); MessageBox.Show(f); the out put is "First" and not "This is First". I also tried like. Application.Current.Properties["First"]

    Read the article

  • WPF Animate and change Opacity of Image in sequence

    - by user1103757
    I have three images, two of these images animate as follow and third image should blink: <Window.Resources> <Storyboard x:Key="AnimateTarget" RepeatBehavior="Forever"> <DoubleAnimationUsingKeyFrames BeginTime="0:0:0" Duration="0:00:03" Storyboard.TargetName="img1" Storyboard.TargetProperty="Y"> <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="200" /> <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="0:0:2" Duration="0:00:03" Storyboard.TargetName="img2" Storyboard.TargetProperty="x"> <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="200" /> <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimation BeginTime="0:0:4" Duration="0:0:0.5" Storyboard.TargetProperty="(Image.Opacity)" Storyboard.TargetName="img3" From="1.0" To="0.0" RepeatBehavior="Forever" AutoReverse="True" /> </Storyboard> </Window.Resources> The first two images are animating fine but the third image doesn’t blink, it will do nothing and just stay there as you can see I have used the following code for blinking the third image: <DoubleAnimation BeginTime="0:0:4" Duration="0:0:0.5" Storyboard.TargetProperty="(Image.Opacity)" Storyboard.TargetName="img3" From="1.0" To="0.0" RepeatBehavior="Forever" AutoReverse="True" /> Also this is a code for the third image: <Image Height="65" Name="image1" Stretch="Fill" Width="67" Source="/PicTakeWPF;component/Images/422505_110594629067212_100003500265268_37406_1212153553_n.jpg"> <Image.RenderTransform> <TranslateTransform x:Name="img3"></TranslateTransform> </Image.RenderTransform> </Image> I would appreciate if someone helps me on this Thanks,

    Read the article

  • WPF DataGrid content does not scroll

    - by muffd
    After searching for a fix to this issue in the previous answers I've decided to post my example. I have the following situation: my datagrid is placed inside a Grid row that is itself placed inside a UserControl.The UserControls does not have a fixed height, as I want the control to resize together with the window. The datagrid is bound to a datasource. Needless to say that the Datagrid itself and its container(the Grid) do not have set a fixed height. My question is: how do I make the vertical scrollbar of the DataGrid to appear?

    Read the article

  • Minimized window position in WPF

    - by DrLazer
    I am trying to save the position of a custom dialog to the users registry, so that when they reload the same dialog, it appears in the same place they moved or resized it to previously. I am saving the windows X position Y position Width and Height. It all works fine except for when the dialog is minimized. If the dialog is minimized and the user right clicks the dialogs representation on the taskbar (windows 7) they can click "close this window". Strangely, the number -32030 gets saved in the registry as the X and Y positions but the width and height get saved correctly. Any idea where this number comes from and what to do in this situation thx

    Read the article

  • WPF TextBox value doesn't change on OnPropertyChanged

    - by jpsstavares
    I have a TextBox whose Value is binded to a ViewModel property: <TextBox Name="txtRunAfter" Grid.Column="4" Text="{Binding Mode=TwoWay, Path=RunAfter}" Style="{StaticResource TestStepTextBox}"/> The set and get were working fine until I tried to add some validation when the Value is set: private int _runAfter = 0; public string RunAfter { get { return _runAfter.ToString(); } set { int val = int.Parse(value); if (_runAfter != val) { if (val < _order) _runAfter = val; else { _runAfter = 0; OnPropertyChanged("RunAfter"); } } } } Although the OnPropertyChanged is reached (I have dubugged that), the View is not changed. How can I make this work? Thanks, José Tavares

    Read the article

  • WPF tooltip best practices

    - by Martin
    I'm about to change my application to include tool tips for all buttons, combo boxes, etc. I was wondering if there are any recommendations on doing this. For every control I'd like the tooltip to show the control's name in bold, followed by the description. I want to keep the style separated from the control, so I can change the tooltip style globally. What I would like to have, unless there's a better suggestion, is two additional fields per button/combobox/etc: 1-ToolTipName and 2-ToolTipDesc, both containing a string. How can I accomplish this (and is it even possible?).

    Read the article

  • WPF WrapPanel - all items should have the same width

    - by John
    I have a ListBox whose ItemsPanel I have replaces with a WrapPanel. The WrapPanel now hosts the databound ListboxItems. Each item has a variable sized text in it, giving each item a different width. However, I want the width to be constant so that all items have the same width as the item with the longest text. Is that possible?

    Read the article

  • Correct way to create a menu with shortcuts in WPF

    - by mattdekrey
    What is the correct/best way to create a menu with hotkey shortcuts? I simply want a File menu like Visual Studio's that has New, Open, Save, Save All, Exit, and a few other standard shortcuts. It seems that InputGestureText displays the appropriate text, but since it's called "Text" and doesn't seem to trigger events, I'm going to assume that isn't the right way to do it. The Command architecture also seems fairly bulky, so I don't want to head down that path if there is a better way.

    Read the article

  • WPF StaticResource bound to subproperty

    - by mizipzor
    I have a class thats created as a resource: <Window.Resources> <Model:MyModel x:Key="model" /> </Window.Resources> The MyModel class has a cli property named Foo. I want the selected value in a combobox to be bound to this property. I thought I could do this but Im getting errors: <ComboBox SelectedItem="{Binding Source={StaticResource model.Foo}}" /> Heres the error: Cannot find resource named '{model.Foo}'. Where did I go wrong? What extra parameters do I need to specify to properly bind to a subproperty?

    Read the article

  • WPF bound object update notification

    - by Carlo
    I have a TreeView with a few objects bound to it, let's say something like this: public class House { public List<Room> Rooms { get; set; } public List<Person> People { get; set; } public House() { this.Rooms = new List<Room>(); this.People = new List<Person>(); } public void BuildRoom(string name) { this.Rooms.Add(new Room() { Name = name }); } public void DestroyRoom(string name) { this.Rooms.Remove(new Room() { Name = name }); } public void PersonEnter(string name) { this.People.Add(new Person() { Name = name }); } public void PersonLeave(string name) { this.People.Remove(new Person() { Name = name }); } } public class Room { public string Name { get; set; } } public class Person { public string Name { get; set; } } The TreeView is watching over the House object, whenever a room is built / destroyed or a person enters / leaves, my tree view updates itself to show the new state of the house (I omitted some implementation details for simplicity). What I want is to know the exact moment when this update finishes, so I can do something right there, the thing is that I created an indicator of the selected item, and when something moves, I need to update said indicator's position, that's the reason I need it exactly when the tree view updates. Let me know if you know a solution to this. Also, the code is not perfect (DestroyRoom and PersonLeave), but you get the idea. Thanks!

    Read the article

  • How to Bind a Command in WPF

    - by MegaMind
    Sometimes we used complex ways so many times, we forgot the simplest ways to do the task. I know how to do command binding, but i always use same approach. Create a class that implements ICommand interface and from the view model i create new instance of that class and binding works like a charm. This is the code that i used for command binding public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DataContext = this; testCommand = new MeCommand(processor); } ICommand testCommand; public ICommand test { get { return testCommand; } } public void processor() { MessageBox.Show("hello world"); } } public class MeCommand : ICommand { public delegate void ExecuteMethod(); private ExecuteMethod meth; public MeCommand(ExecuteMethod exec) { meth = exec; } public bool CanExecute(object parameter) { return false; } public event EventHandler CanExecuteChanged; public void Execute(object parameter) { meth(); } } But i want to know the basic way to do this, no third party dll no new class creation. Do this simple command binding using a single class. Actual class implements from ICommand interface and do the work.

    Read the article

  • WPF: Bind DataGrid to List<String>

    - by Sam
    Funny, how sometimes the simple things bite me in the behind. I can bind a DataGrid nicely to a Collection of some arbitrary class, using a DataGridTextColumn like this: <DataGridTextColumn Header="Name" Binding="{Binding Name}"/> Now I want to bind a DataGrid to a simple Collection. So since there is no property "Name" or something like that to bind to, how do I write the binding: <DataGridTextColumn Header="Name" Binding="{Binding ???}"/> String has no Property "Value" or something like that. And if I just write {Binding } I'll end up with a one-way-binding, unable to write changes back to the Collection. Thinking about it, I think it is not possible to bind to a collection, so I do need to wrap my string into a class? Or is there a way?

    Read the article

  • WPF, convert Path.DataProperty to Segment objects

    - by user275587
    I was wondering if there was a tool to convert a path data like "M 0 0 l 10 10" to it's equivalent line/curve segment code. Currently I'm using: string pathXaml = "<Path xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" Data=\"M 0 0 l 10 10\"/>"; Path path = (Path)System.Windows.Markup.XamlReader.Load(pathXaml); It appears to me that calling XamlParser is much slower than explicitly creating the line segments. However converting a lot of paths by hand is very tedious.

    Read the article

< Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >