Search Results

Search found 6871 results on 275 pages for 'wpf xaml'.

Page 16/275 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Nested WPF DataGrids

    - by jvberg
    I have a DataGrid (from the toolkit) and I want to nest another DataGrid in the DataGrid.RowDetailsTemplate. The trick is I want to bring back the data from one table in the main grid and then based on row selection go and get additonal detail from a different table and show it in the DataGrid in the detail template. This is easy enough to do in 2 seperate DataGrids but I am having trouble getting it to work with the nested version. Is this even possible? If so, could someone point me in the right direction. I should note I am using LinqToSql clases to populate the data. Thanks for your consideration. -Joel

    Read the article

  • WPF Window Top Won't Change.

    - by Kevin Lam
    Hi, I am using animations with my window to slide out or slide back up. But when these animations are not used. I would like to use Window.Top to set the position of the window, but I think due to animations I cannot set the top. I was wondering if anyone knows how to fix this? Thanks example. window.top is already = 33. but when is ay window.top =900; it will stay at 33.

    Read the article

  • Adding a button to a combobox in wpf

    - by Chris McGrath
    Pretty much I have an Editable Combobox and I want to add a button to the right of the drop down button which clears the selected item. So... |TextBox |X|v| I was thinking something like... <Style...> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ControlTemplate.Resources> <Style TargetType="{x:Type TextBox}">...Add button here...</Style> </ControlTemplate.Resources> <ContentPresenter /> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • WPF button template alignment not setting correctly

    - by Dave Colwell
    Hi guys, I have created a button template consisting of a border and a content presenter. A style is then wrapped around this template and applied to a button, when this button is used it is not carrying the values for horizontal and vertical alignment. In the designer the allignments are showing and the button is in the correct place, but when i run the program the button appears to have horizontal alignment = left and vertical alignment = right. Any ideas?

    Read the article

  • WPF - Extend ListView with checkable AND selectable ListViewItems

    - by Marks
    Hi there. I already read many examples on extending ListViews with checkboxes bound with IsSelected. But I want something more. I want a seperation between the checked and selected state, so i get a ListBox that has a single selected item, but can have multiple checked items. Unfortunately ListViewItem does not have a property for checked and I dont see a possibility to get the ListView to work with a custom CheckableListViewItem. Of course i could use a List of objects with a checked property as ItemSource, but I dont think thats a good way to go. Checked or not is a matter of the list or item-container, not of the object listed in it. Beside that I dont want all my classes like user, role, group to have counterparts like checkableUser, checkableRole and checkableGroup. The behaviour i want can be easyly accomblished for the UI with a <DataTemplate x:Key="CheckBoxCell"> <StackPanel Orientation="Horizontal"> <CheckBox /> </StackPanel> </DataTemplate> and a <GridViewColumn CellTemplate="{StaticResource CheckBoxCell}" Width="30"/> But without a binding on the checkbox i cant check if it is checked or not. Is there any way to accomplish something like that? The perfect solution for me would be to have listView1.SelectedItem, listView1.CheckedItems and maybe a listView1.UncheckedItems and of course listView1.CheckItem and listView1.UncheckItem. Thanks for any help.

    Read the article

  • wpf Image resources and visual studio 2010 resource editor

    - by Berryl
    Hello My motivation for this question is really just to specify an image to be used in a user control via a dependency property for ImageSource. I'm hitting some pain points involving the management, access, and unit testing for this. Is the resource editor a good tool to use to maintain images for the application? What is the best way to translate the Bitmap from the editor to an ImageSource? How can I grab the resource Filename from the editor? Cheers, Berryl

    Read the article

  • How to assign WPF resources to other resource tags

    - by Tom
    This is quite obscure, I may just be missing something extremely simple. Scenario 1 Lets say I create a gradient brush, like this in my <Window.Resources> section: <LinearGradientBrush x:Key="GridRowSelectedBackBrushGradient" StartPoint="0,0" EndPoint="0,1"> <GradientStop Color="#404040" Offset="0.0" /> <GradientStop Color="#404040" Offset="0.5" /> <GradientStop Color="#000000" Offset="0.6" /> <GradientStop Color="#000000" Offset="1.0" /> </LinearGradientBrush> Then much later on, I want to override the HighlightBrushKey for a DataGrid. I have basically done it like this (horrible); <LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" GradientStops="{Binding Source={StaticResource GridRowSelectedBackBrushGradient}, Path=GradientStops}" StartPoint="{Binding Source={StaticResource GridRowSelectedBackBrushGradient}, Path=StartPoint}" EndPoint="{Binding Source={StaticResource GridRowSelectedBackBrushGradient}, Path=EndPoint}" /> This is obviously not the most slick way of referencing a resource. I also came up with the following problem, which is almost identical. Scenario 2 Say I created two colors in my <Window.Resources> markup, like so: <SolidColorBrush x:Key="DataGridRowBackgroundBrush" Color="#EAF2FB" /> <SolidColorBrush x:Key="DataGridRowBackgroundAltBrush" Color="#FFFFFF" /> Then later on, I want to supply them in an Array, which feeds the ConverterParameter on a Binding so I can supply the custom Converter with my static resource instances: <Setter Property="Background"> <Setter.Value> <Binding RelativeSource="{RelativeSource Mode=Self}" Converter="{StaticResource BackgroundBrushConverter}"> <Binding.ConverterParameter> <x:Array Type="{x:Type Brush}"> <SolidColorBrush Color="{Binding Source={StaticResource DataGridRowBackgroundBrush}, Path=Color}" /> <SolidColorBrush Color="{Binding Source={StaticResource DataGridRowBackgroundAltBrush}, Path=Color}" /> </x:Array> </Binding.ConverterParameter> </Binding> </Setter.Value> </Setter> What I've done is attempt to rereference an existing resource, but in my efforts I've actually recreated the resource, and bound the properties so they match. Again, this is not ideal. Because I've now hit this problem at least twice, is there a better way? Thanks, Tom

    Read the article

  • Displaying a collection of controls in a specific way in WPF

    - by Alvaro
    I have a collection of controls "MyCollection" wich changes in the Runtime. And I have to follow some constraints for that, for example: If my parameter "MyCollection.Count = 4" the property "NumberOfcolumns" will have the value 2, in order to create new Lines, and show the controls Two per Two. This is how I'm displaying my collection : <ItemsControl ItemsSource="{Binding MyCollection}" BorderThickness="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate > <UniformGrid Columns="{Binding NumberOfColumns}" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> The problem is that my controls have different sizes, and as In UniformGrids, Cells are uniform... My design is not really pretty, because I have little controls shown in big Cells !! Can someone help me to solve this problem ? NB: Please give me a detailled solution if possible, not something like : "Use WrapPanel..."

    Read the article

  • Making a moveable control in WPF

    - by Dave Colwell
    Hi guys, I have a panel, within that panel are several rectangular controls (the number of controls vaires) I want the user to be able to move the controls around within the panel so that they can arrange the controls in the way that suits them best. does anyone have any resources i could read or simple tips which would get me headed down the right road?

    Read the article

  • List<string> doesn't update the UI when change occurs [WPF]

    - by Hard Turner
    <ListBox x:Name="MainList" HorizontalAlignment="Left" Height="468" Margin="10,10,0,0" VerticalAlignment="Top" Width="100" ItemsSource="{Binding Items,Mode=TwoWay}" DisplayMemberPath="Name"/> [Serializable()] public class MYcontainer : INotifyPropertyChanged,ISerializable { private List<MYClass> _items = new List<MYClass>(); public List<MYClass> Items { get{ return _items;} set { this._items =value; OnPropertyChanged("Items"); } public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string propertyName = null) { var eventHandler = this.PropertyChanged; if (eventHandler != null) eventHandler(this, new PropertyChangedEventArgs(propertyName)); } } when i add an item to "Items" the UI doesnt update, the binding is working fine, since if i closed the window and opened it again, the new items appear correctly what am i doing wrong? i know if i used observablecollection it will work fine, but shouldn't it work with List<? , i already have in another window a string[] property and it update fine

    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

  • Pattern Brushes in WPF

    - by daub815
    I am struggling with creating various brushes to fill in various shapes or as a background. Here are some patterns I am struggling with creating: <<<< <|<|<|<|||| //////// \\\\ |||||||| I've been able to create the \\\, //////, and |||||| with a linear gradient, but the first two are causing me issues. BTW, the second one is a triangle. Any suggestions or help would be greatly appreciated.

    Read the article

  • WPF control not being updated when source is changed

    - by Dave Colwell
    Hi, I have a ListBox which is bound to a list of objects. When the system initializes, the binding is done just fine, When i update the value in one of the fields on the ListBox, the item in the background updates as well, but when i update the value in the background it is not reflected in the ListBox. Does anyone know why this is?

    Read the article

  • WPF Binding Path=/ not working?

    - by Mark
    I've set up my DataContext like this: <Window.DataContext> <c:DownloadManager /> </Window.DataContext> Where DownloadManager is Enumerable<DownloadItem>. Then I set my DataGrid like this: <DataGrid Name="dataGrid1" ItemsSource="{Binding Path=/}" ... So that it should list all the DownloadItems, right? So I should be able to set my columns like: <DataGridTextColumn Binding="{Binding Path=Uri, Mode=OneWay}" Where Uri is a property of the DownloadItem. But it doesn't seem to like this. In the visual property editor, it doesn't recognize Uri is a valid property, so I'm guessing I'm doing something wrong. It was working before, when I had the data grid binding to Values, but then I took that enumerable out of the DownloadManager and made itself enumerable. How do I fix this? PS: By "doesn't work" I mean it doesn't list any items. I've added some to the constructor of the DM, so it shouldn't be empty.

    Read the article

  • WPF: ListBox click and drag selects other items

    - by Bodekaer
    Hi, Simple question: 1) I click and hold the mouse on a ListBoxItem in a ListBox. 2) Now I drag the mouse cursor down over the next ListBoxItem in the list It now selects this new item. I would like to disable this. So the user has to click an item to select it. Not just drag over it. I have Single selection turned on. Any ideas are greatly appreciated :)

    Read the article

  • WPF format displayed text?

    - by Mark
    I have a column defined like this: <DataGridTextColumn Binding="{Binding Path=FileSizeBytes, Mode=OneWay}" Header="Size" IsReadOnly="True" /> But instead of displaying the file size as a big number, I'd like to display units, but still have it sort by the actual FileSizeBytes. Is there some way I can run it through a function or something before displaying it?

    Read the article

  • ParallelWork: Feature rich multithreaded fluent task execution library for WPF

    - by oazabir
    ParallelWork is an open source free helper class that lets you run multiple work in parallel threads, get success, failure and progress update on the WPF UI thread, wait for work to complete, abort all work (in case of shutdown), queue work to run after certain time, chain parallel work one after another. It’s more convenient than using .NET’s BackgroundWorker because you don’t have to declare one component per work, nor do you need to declare event handlers to receive notification and carry additional data through private variables. You can safely pass objects produced from different thread to the success callback. Moreover, you can wait for work to complete before you do certain operation and you can abort all parallel work while they are in-flight. If you are building highly responsive WPF UI where you have to carry out multiple job in parallel yet want full control over those parallel jobs completion and cancellation, then the ParallelWork library is the right solution for you. I am using the ParallelWork library in my PlantUmlEditor project, which is a free open source UML editor built on WPF. You can see some realistic use of the ParallelWork library there. Moreover, the test project comes with 400 lines of Behavior Driven Development flavored tests, that confirms it really does what it says it does. The source code of the library is part of the “Utilities” project in PlantUmlEditor source code hosted at Google Code. The library comes in two flavors, one is the ParallelWork static class, which has a collection of static methods that you can call. Another is the Start class, which is a fluent wrapper over the ParallelWork class to make it more readable and aesthetically pleasing code. ParallelWork allows you to start work immediately on separate thread or you can queue a work to start after some duration. You can start an immediate work in a new thread using the following methods: void StartNow(Action doWork, Action onComplete) void StartNow(Action doWork, Action onComplete, Action<Exception> failed) For example, ParallelWork.StartNow(() => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }, () => { workEndedAt = DateTime.Now; }); Or you can use the fluent way Start.Work: Start.Work(() => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }) .OnComplete(() => { workCompletedAt = DateTime.Now; }) .Run(); Besides simple execution of work on a parallel thread, you can have the parallel thread produce some object and then pass it to the success callback by using these overloads: void StartNow<T>(Func<T> doWork, Action<T> onComplete) void StartNow<T>(Func<T> doWork, Action<T> onComplete, Action<Exception> fail) For example, ParallelWork.StartNow<Dictionary<string, string>>( () => { test = new Dictionary<string,string>(); test.Add("test", "test"); return test; }, (result) => { Assert.True(result.ContainsKey("test")); }); Or, the fluent way: Start<Dictionary<string, string>>.Work(() => { test = new Dictionary<string, string>(); test.Add("test", "test"); return test; }) .OnComplete((result) => { Assert.True(result.ContainsKey("test")); }) .Run(); You can also start a work to happen after some time using these methods: DispatcherTimer StartAfter(Action onComplete, TimeSpan duration) DispatcherTimer StartAfter(Action doWork,Action onComplete,TimeSpan duration) You can use this to perform some timed operation on the UI thread, as well as perform some operation in separate thread after some time. ParallelWork.StartAfter( () => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }, () => { workCompletedAt = DateTime.Now; }, waitDuration); Or, the fluent way: Start.Work(() => { workStartedAt = DateTime.Now; Thread.Sleep(howLongWorkTakes); }) .OnComplete(() => { workCompletedAt = DateTime.Now; }) .RunAfter(waitDuration);   There are several overloads of these functions to have a exception callback for handling exceptions or get progress update from background thread while work is in progress. For example, I use it in my PlantUmlEditor to perform background update of the application. // Check if there's a newer version of the app Start<bool>.Work(() => { return UpdateChecker.HasUpdate(Settings.Default.DownloadUrl); }) .OnComplete((hasUpdate) => { if (hasUpdate) { if (MessageBox.Show(Window.GetWindow(me), "There's a newer version available. Do you want to download and install?", "New version available", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { ParallelWork.StartNow(() => { var tempPath = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Settings.Default.SetupExeName); UpdateChecker.DownloadLatestUpdate(Settings.Default.DownloadUrl, tempPath); }, () => { }, (x) => { MessageBox.Show(Window.GetWindow(me), "Download failed. When you run next time, it will try downloading again.", "Download failed", MessageBoxButton.OK, MessageBoxImage.Warning); }); } } }) .OnException((x) => { MessageBox.Show(Window.GetWindow(me), x.Message, "Download failed", MessageBoxButton.OK, MessageBoxImage.Exclamation); }); The above code shows you how to get exception callbacks on the UI thread so that you can take necessary actions on the UI. Moreover, it shows how you can chain two parallel works to happen one after another. Sometimes you want to do some parallel work when user does some activity on the UI. For example, you might want to save file in an editor while user is typing every 10 second. In such case, you need to make sure you don’t start another parallel work every 10 seconds while a work is already queued. You need to make sure you start a new work only when there’s no other background work going on. Here’s how you can do it: private void ContentEditor_TextChanged(object sender, EventArgs e) { if (!ParallelWork.IsAnyWorkRunning()) { ParallelWork.StartAfter(SaveAndRefreshDiagram, TimeSpan.FromSeconds(10)); } } If you want to shutdown your application and want to make sure no parallel work is going on, then you can call the StopAll() method. ParallelWork.StopAll(); If you want to wait for parallel works to complete without a timeout, then you can call the WaitForAllWork(TimeSpan timeout). It will block the current thread until the all parallel work completes or the timeout period elapses. result = ParallelWork.WaitForAllWork(TimeSpan.FromSeconds(1)); The result is true, if all parallel work completed. If it’s false, then the timeout period elapsed and all parallel work did not complete. For details how this library is built and how it works, please read the following codeproject article: ParallelWork: Feature rich multithreaded fluent task execution library for WPF http://www.codeproject.com/KB/WPF/parallelwork.aspx If you like the article, please vote for me.

    Read the article

  • WPF Control validation

    - by Jon
    Hi all, I'm developing a WPF GUI framework and have had bad experiences with two way binding and lots of un-needed events being fire(mainly in Flex) so I have gone down the route of having bindings (string that represent object paths) in my controls. When a view is requested to be displayed the controller loads the view, and gets the needed entities (using the bindings) from the DB and populates the controls with the correct values. This has a number of advantages i.e. lazy loading, default undo behaviour etc. When the data in the view needs to be saved the view is passed back to the controller again which basically does the reserve i.e. re-populates the entities from the view if values have changed. However, I have run into problems when I try and validate the components. Each entity has attributes on its properties that define validation rules which the controller can access easily and validate the data from the view against it. The actual validation of data is fine. The problem comes when I want the GUI control to display error validation information. It I try changing the style I get errors saying styles cannot be changed once in use. Is the a way in c# to fire off the normal WPF validation mechanism and just proved it with the validaiton errors the controller has found? Thanks in advance Jon

    Read the article

  • General Question About WPF Control Behavior and using Invoke

    - by Phil Sandler
    I have been putting off activity on SO because my current reputation is "1337". :) This is a question of "why" and not "how". By default, it seems that WPF does not set focus to the first control in a window when it's opening. In addition, when a textbox gets focus, by default it does not have it's existing text selected. So basically when I open a window, I want focus on the first control of the window, and if that control is a textbox, I want it's existing text (if any) to be selected. I found some tips online to accomplish each of these behaviors, and combined them. The code below, which I placed in the constructor of my window, is what I came up with: Loaded += (sender, e) => { MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); var textBox = FocusManager.GetFocusedElement(this) as TextBox; if (textBox != null) { Action select = textBox.SelectAll; //for some reason this doesn't work without using invoke. Dispatcher.Invoke(DispatcherPriority.Loaded, select); } }; So, my question. Why does the above not work without using Dispatcher.Invoke? Is something built into the behavior of the window (or textbox) cause the selected text to be de-selected post-loading? Maybe related, maybe not--another example of where I had to use Dispatcher.Invoke to control the behavior of a form: http://stackoverflow.com/questions/2602979/wpf-focus-in-tab-control-content-when-new-tab-is-created

    Read the article

  • WPF Dynamic Layout with ItemsControl and Grid

    - by Jason Williams
    I am creating a WPF form. One of the requirements is that it have a sector-based layout so that a control can be explicitly placed in one of the sectors/cells. I have created a tic-tac-toe example below to convey my problem: There are two types and one base type: public class XMoveViewModel : MoveViewModel { } public class OMoveViewModel : MoveViewModel { } public class MoveViewModel { public int Row { get; set; } public int Column { get; set; } } The DataContext of the form is set to an instance of: public class MainViewModel : ViewModelBase { public MainViewModel() { Moves = new ObservableCollection<MoveViewModel>() { new XMoveViewModel() { Row = 0, Column = 0 }, new OMoveViewModel() { Row = 1, Column = 0 }, new XMoveViewModel() { Row = 1, Column = 1 }, new OMoveViewModel() { Row = 0, Column = 2 }, new XMoveViewModel() { Row = 2, Column = 2} }; } public ObservableCollection<MoveViewModel> Moves { get; set; } } And finally, the XAML looks like this: <Window.Resources> <DataTemplate DataType="{x:Type vm:XMoveViewModel}"> <Image Source="XMove.png" Grid.Row="{Binding Path=Row}" Grid.Column="{Binding Path=Column}" Stretch="None" /> </DataTemplate> <DataTemplate DataType="{x:Type vm:OMoveViewModel}"> <Image Source="OMove.png" Grid.Row="{Binding Path=Row}" Grid.Column="{Binding Path=Column}" Stretch="None" /> </DataTemplate> </Window.Resources> <Grid> <ItemsControl ItemsSource="{Binding Path=Moves}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid ShowGridLines="True"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> </Grid> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </Grid> What was not so obvious to me when I started was that the ItemsControl element actually wraps each item in a container, so my Grid.Row and Grid.Column bindings are ignored since the images are not directly contained within the grid. Thus, all of the images are placed in the default Row and Column (0, 0). What is happening: The desired result: So, my question is this: how can I achieve the dynamic placement of my controls in a grid? I would prefer a XAML/Data Binding/MVVM-friendly solution. Thanks.

    Read the article

  • Wpf Combobox in Master/Detail MVVM

    - by isak
    I have MVVM master /details like this: <Window.Resources> <DataTemplate DataType="{x:Type model:EveryDay}"> <views:EveryDayView/> </DataTemplate> <DataTemplate DataType="{x:Type model:EveryMonth}"> <views:EveryMonthView/> </DataTemplate> </Window.Resources> <Grid> <ListBox Margin="12,24,0,35" Name="schedules" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Elements}" SelectedItem="{Binding Path=CurrentElement}" DisplayMemberPath="Name" HorizontalAlignment="Left" Width="120"/> <ContentControl Margin="168,86,32,35" Name="contentControl1" Content="{Binding Path=CurrentElement.Schedule}" /> <ComboBox Height="23" Margin="188,24,51,0" Name="comboBox1" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Schedules}" SelectedItem="{Binding Path=CurrentElement.Schedule}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding Path=CurrentElement.Schedule.ID}" /> </Grid> This Window has DataContext class: public class MainViewModel : INotifyPropertyChanged { public MainViewModel() { _elements.Add(new Element("first", new EveryDay("First EveryDay object"))); _elements.Add(new Element("second", new EveryMonth("Every Month object"))); _elements.Add(new Element("third", new EveryDay("Second EveryDay object"))); _schedules.Add(new EveryDay()); _schedules.Add(new EveryMonth()); } private ObservableCollection<ScheduleBase> _schedules = new ObservableCollection<ScheduleBase>(); public ObservableCollection<ScheduleBase> Schedules { get { return _schedules; } set { _schedules = value; this.OnPropertyChanged("Schedules"); } } private Element _currentElement = null; public Element CurrentElement { get { return this._currentElement; } set { this._currentElement = value; this.OnPropertyChanged("CurrentElement"); } } private ObservableCollection<Element> _elements = new ObservableCollection<Element>(); public ObservableCollection<Element> Elements { get { return _elements; } set { _elements = value; this.OnPropertyChanged("Elements"); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } One of Views: <UserControl x:Class="Views.EveryDayView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Grid > <GroupBox Header="Every Day Data" Name="groupBox1" VerticalAlignment="Top"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TextBox Name="textBox2" Text="{Binding Path=AnyDayData}" /> </Grid> </GroupBox> </Grid> I have problem with SelectedItem in ComboBox.It doesn't works correctly.

    Read the article

  • Setting a theme in WPF

    - by muckdog12
    I have a relativly simple question that I can't seem to figure out. I have downloaded some theme files in an XAML format off the internet and I would like to use them as my themes in my WPF application. How do you do this? All help is appreciated!

    Read the article

  • ListView containing Bitmaps with Zoom Animation in WPF

    - by Ashish Ashu
    I have a simple requirement as mentioned below: A ListView or any control displays list of bitmaps/images. When user mouse hovers on any bitmap that bitmap zoomed to show that is currently selected. Since I have to provide drag drop operations and click operation that why I taken the list view. Pleas help!! It will be great if any body provide the xaml to this..

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >