wpf

WPF UI persistence in TabControl

I am having issues with something that seems like it should be very simple but in fact has proven quite difficult. Lets say you have a TabControl bound to an itemsource of ViewModels and the items displayed using a DataTemplate. Now lets say the DataTemplate consists of a Grid with two columns and a Grid splitter to resize the columns. ...

Bind a control to a single value in a collection/array in WPF

Hi there In WPF I have a collection of bool? values and I want to bind each of these to a separate checkbox programmatically. I want the bindings to be TwoWay so that changing the value of the individual item in the collection in code updates the check box and vice versa. I have spent ages trying to figure out how to do this and I am c...

Creating a 3D Carousel in Silverlight

Hi, I would like to make a 3D carousel of planes which have videos or images used as textures. I know this can be done in WPF but I'm interested to know if such a thing is possible in Sivlerlight and how much different and more(less) difficult would it be to create as opposed to the one in WPF. Are there Viewport3Ds, MeshGeometries, Mo...

Copy to output directory issue with .inf file

Apologies if dup, I did try searching several times and found nothing like it... I have a number of 'config' files that my application edits. Really it is just a gui for editing these files as they have a special format. Anyway, everytime I put a new group of files in visual studio, and select "Copy to Output directory" to "Copy always"...

WPF - Converting to multiple properties possible?

I have a textbox and a checkbox, i would like to set three properties on the textbox based on whether the checkbox is checked or not. I can bind the properties to the checkbox but then i need to know what property is being bound in the converter. For example, when unchecked i would like the textbox properties to be AcceptsReturn="False...

ado.net dirty records in dataset

Hello, I'll try to explain. I want to track dirty records in my dataset row that is bound to controls on window (wpf). It works fine. Lets say i begin to edit some textbox that is bound to dataTable in that dataSet. After i add one character to textbox, dataset is marked dirty. But if I delete that character again ( restore original va...

MonthCalendar in WPF?

Is there a free class library that offers a MonthCalendar control for WPF? And is the MonthCalendar equal to if not better than the Winforms MonthCalendar. ...

Walk the VisualTree in a worker thread for fulltext search

I am using WPF to show complex data (think reporting). I now need to have a fulltext search for it. We currently do this by walking the visual tree looking for textblocks. It seems that this needs to be done on the UI thread, is that right? The problem here is that it might take quite a while until the next match is found during wich the...

Changing the font color on a disabled checkbox in WPF

I'm hoping this is an easy answer, as I'm just learning WPF. I've got a resource dictionary that defines all our styles. Currently the checkbox style looks like: <Style x:Key="StandardCheckboxStyle" TargetType="{x:Type CheckBox}"> <Setter Property="Foreground" Value="{Binding Source={StaticResource BrandInfo}, XPath=//Colors/@TextC...

How to read system time in WPF for updating SQL Server timestamp field?

For the purpose of organizing streamlined database timer-based polling, with every updating of database table I need to update a timestamp field in a SQL Server 2008 database (then poll, read its value, compare with the value in front-end and making decisions about reading the whole table). Regarding all this, how I could read system ti...

How to access ItemsCount on a Group Item within WPF ListView in code?

I have XAML code with a grouped ListView that looks like the following: <ListView ItemsSource="{Binding}" Name="ContactList"> <ListView.ItemTemplate> <DataTemplate> <controls:ContactItemControl /> </DataTemplate> </ListView.ItemTemplate> <ListView.Gr...

Wpf - Combobox Binding to a DateTime ArrayList

I have a static ArrayList of DateTimes <Window.Resources> <col:ArrayList x:Key="startHours"> <sys:DateTime>0:00</sys:DateTime> <sys:DateTime>0:30</sys:DateTime> <!-- .... --> </col:ArrayList> </Window.Resources> I want to fill a combobox with hour:minute formatted dates, so I do <ComboBox x:Name="cmbF...

Explicitly refresh DataTemplate from a DataTemplateSelector?

Hello. I set up a ContentControl.DataTemplateSelector to my desired one. I want that according to a command or whatever, call the ContentControl to reselect the template from the selector by either xaml or code. Thank ...

wpf treeviewitem

Hi I am creating a TreeView using the following method looping through an xml document. However when any treeviewitem is selected all the nodes in the hierarchy are getting the event triggers instead of just the selected TreeViewItem. For example let's say we select the grandchild of a node. All the nodes including grandchild, child,...

WPF ListBox: how to update data with binding

I have listbox that displays information about list of objects: <ListBox Grid.Column="0" Height="152" Name="CustomersList" HorizontalAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name, Mode=OneWay}"/> <...

How to add access keys to menu items?

<MenuItem x:Name="newProjectButton" Click="OnNewProjectButton_Click" Header="_New Project"> </MenuItem> I want to call OnNewProjectButton_Click whenever Alt+N is pressed. The code above doesn't work, unfortunately, because the handler is called only if the menu is expanded (i.e. has focus). ...

How can I catch both single-click and double-click events on WPF FrameworkElement?

I can catch a single-click on a TextBlock like this: private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { MessageBox.Show("you single-clicked"); } I can catch a double-click on a TextBlock like this: private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonS...

c#: Choosing or modifying a control to create draggable graphics on a canvas

I'm attempting to write a small app that will do something similar to what is shown here: http://www.soccertutor.com/tour/MASTER_SKIN_team.swf However I've not used WPF/Win Forms very much at all and can't seem to find a control that will be most applicable to the situation. I want to have some sort of grid for the pitch so I can have ...

WPF Tab Control: Setting Tab Color?

I have a tab control in my WPF application that uses the default colors for the WPF tab control. In other words, the active tab is white, and the inactive tabs are silver. I have changed the background color of all of the tab pages to Beige, by setting the Background property of the TabControl object, but it doesn't change the tab color,...

WPF - how do I extend (or work in parallel with) the built-in command mechanism?

Please excuse me if this is a dumb question - I have read a dozen articles on the WPF command infrastructure and I am more confused than ever. I understand that I can use the built-in commands to implement (for example) a toolbar that will apply standard cut/copy/paste functionality to any focused textbox: <ToolBar> <Button Command...