wpf

Databinding: using the static resource (assigning programatically?) DataGrid

Perhaps it would be better if I explained why I need to do this. This is not the true example, but in my working solution, the user will start with a relation group like this: Apple -> Red Banana -> Yellow In the app, in different screens (e.g. Add fruit and add color) they have the power to add new fruits/colors. They then need to li...

UI Automation on Custom Control: Need to use CTRL+TAB (tab focuses on first object)

I have a custom control that is derived from ListView. This list view uses a GridView with two columns (each templated appropriately): one column is the caption (just a label) and the other column is the control. When used, it looks like this: <l:CoolList> <TextBox l:CoolList.Caption="Name" Text={Binding Name} /> <TextBox l:C...

WPF: List boxes and virtualization

How do I know whether or not my list is being virtualized? How do I make this snippet virtualized? <ScrollViewer Grid.Column="1" Name="LogScroller"> <r:NoInheritanceContentControl> <ListBox Background="Black" ItemsSource="{Binding Path=ActiveLog}" > <ListBox.ItemTemplate> <DataTemplate> ...

Ways to identify which cell was clicked on WPF Grid?

Hi I have a 3x3 matrix grid. If a user on particular cell, how can I identify the cell cordinates after click? Please advise. thanks PJ ...

WPF databinding - an interesting problem

I have a database with a table that records data coming from various sources. 3 columns 'Source' 'Value' 'Timestamp' e.g. source1 21 '11:03' source6 22 '11:03' source9 456 '11:03' The table is updated 2 to 3 times a second. Each Value may or may not change. Each 'Source' value is displayed in a seperate label or text box on the s...

Playing games over internet with WPF apps?

Hi I am trying to develop a multi player game over the internet. A 2 to 4 players game in WPF. Since I want to make it available via browser also at some point, is "WPF-Browser Application" a good choice? What approach I can follow to maintain the connectivity between players? Peer to peer or do I need to maintain a server in between a...

Determine size of SizeToContent WPF Window before its rendered

I have a window in my WPF application that is displayed on occasion. When it is shown it is faded in with an annimation, and when closed it is faded out. Nothing fancy, just a storyboard that modifies the opacity. Actually the window is never really closed, the opacity is just faded out to 0 where it remains until its to be displayed a...

Why WPF? (As 2D vector graphics API)

Hello everyone, I have a visualizing module for 2D vector graphics. All calls to drawing API are strictly isolated there. I want to be able replace one drawing API with another drawing API just by reimplementing the module. All data for visualizing are transmitted into the module through a single interface named Ixxx. I have a choice be...

WPF: How do I apply custom formatting to a ListView?

My ListView is petty simple: <ListView ItemsSource="{Binding Path=ActiveCounters}"> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}" /> <GridViewColumn Header="Value" DisplayMemberBinding="{Binding Path=Value}" /> <GridViewColumn Heade...

Developing wizard UI - WPF

All in WPF: Developing a wizard application, user has to answer a number of simple questions before brought to the main app. The main app is then prefilled with the information obtained from the wizard. I started with a Window which I then planned to add usercontrols to. The main window would have the user control in the first row, the...

WPF: One-way IValueConverter

From what I've been told, I need to create a IValueConverter to do my custom formatting. The problem is my formatting is one-way, there is no legitmate ConvertBack implementation. So, how do I handle one-way IValueConverters. (If it helps, this is for a read-only control.) ...

How to calculate translate while zooming in WPF/Surface

I'm doing a surface app where I need to scale my scene (zoom) while the user scales with their fingers (i.e pinching) Currently I have it working ok, but the issue is that I need to zoom in on the center point between the users fingers. I have the point, but the maths behind the translation is hard to grasp. When I apply a ScaleTransf...

WPF: How do I set the Foreground property of a TextBlock using DataTrigger

This is my XAML: <TextBlock Name="SeverityText" Grid.Column="1" Grid.Row="0" Foreground="Red"> <TextBlock.Triggers> <DataTrigger Binding="{Binding Path=Severity}"> <DataTrigger.Value> <sm:Severity>Warning</sm:Severity> </DataTrigger.Value> ...

Databinding to functions in dynamically-loaded plugins

I have several MenuItems whose Commands are bound to my ViewModel. Until today, all of them execute properly. Now I have added a MenuItem whose ItemsSource is bound to an ObservableCollection. The point of this MenuItem is to enumerate a list of plugins so that the name of all plugins show up. Then when the user clicks on a plugin na...

Unable to attach multiple styles in Visual Studio 2008

Helo! I create in my project a folder named 'Templates'. In this folder I store all my DataTemplates declared in various ResourceDictionary files. I am attaching it (so it becomes a StaticResource and I can use it everywhere in the <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> ...

Drag and drop between ListBox items and Grid cells in WPF?

Hi There is a list box with some items in it. Also there is a grid with 3x3 matrix. The user will be dragging an item and dropping on one the cells of grid. Most of the samples I found are about dragging-dropping from one listbox to another listbox. But I want to drop in one cell of grid. How can I achieve this? Please advise. thanks P...

WPF: Layout Question

My user control has two sub-controls, a list and a detail. When nothing is selected in the list, I want the list to fill the entire control When something is selected, I want the list to fill the top half and the detail control the bottom half. Dynamically changing the visibility on the detail control is easy. What I'm stuck on is ho...

WPF Change style of surrounding border on mouse over

I have a Grid with a Border around it. Upon mouse over on the Grid, I want to change the style on the Border. How would I go about doing this? This is what I've tried, without any success so far: <Border Name="Border" BorderBrush="Transparent" BorderThickness="1" CornerRadius="2"> <Grid> <Grid.Style> <Style Targe...

Command line arguments and single instance WPF application

Hi, the WPF app I have has been redesigned to use tabs and be single instance. The new requirement is now that when launched with command line options and an instance of the app is already running - the already running instance should open a new tab and do some work based on the cmdline options. the single instance is no prob - but how ...

image and text in listobx

I want to inesrt one image beside one text,like this i have to include three items in listbox. in run time. If the number of items is more than 3,then the last items get removed. How can i do that in WPF,C#. And the newly added item should get added in first place. Now i did up to include text at runtime. if (listBox1.Items.Count >= 3) ...