wpf

What is the best way in WPF/Silverlight for simple dropdown that displays appropriate data?

Below is a simple WPF application which displays Customers with the most orders which is collected from the database via LINQ-to-SQL in the code-behind. What is the best way to extend this WPF application so that the user can select from a dropdown, e.g.: Customers with the most orders Customers with the least orders Customers by city...

Explain strange Dispatcher behavior (a hidden WPF feature)

I have a window with a single button within. The code-behind is private void Button_Click(object sender, RoutedEventArgs e) { Trace.TraceInformation("Button ThreadId: {0}", Thread.CurrentThread.ManagedThreadId); Thread w = new Thread((ThreadStart) Worker); w.SetApartmentState(ApartmentState.STA); // removing/adding this d...

adding adorners to legacy textboxes

Whats the best way to add an adornment layer to legacy controls, or in other words you know jetbrains refactoring tools, how do they draw the squiggly lines under incorrect text? Also on another note can one draw said adorments on controls not under the direct reference of the application, ie using a handle? If you have insights, or jus...

TypeInitilizationException when initalizing a Subclass with a Dependency Property

I have the following simple TextBox subclass, which adds one dependency property (OutputIndex): public class OutputTextBox : TextBox { public OutputTextBox() : base() { } public int OutputIndex { get { return (int)this.GetValue(OutputIndexProperty); } set { this.SetValue(OutputIndexProperty, value); } } ...

What version of IE is used in the WPF .NET 3.5sp1 frame control?

When using the frame control to display web content? thanks ...

TabControl and set the focus on a textbox in WPF

I have a tabcontrol in WPF When I switch to a specific tabItem , I want to set the focus on a specific textBox I added the code of textBox_n.Focus(); in the event handler of selectionChanged, but it didn't work. I added the code in the event handler of the tabItem's GotFocus, but funny enough calling textBox_n.Focus(), was calling the ...

WPF Grid data binding

I have a grid with just 1 row. I would like the amount of columns to be determined by the data context of the grid. For instance, if I have a list of names exposed in an ObservableCollection property called 'Names' that return "Fred", "Joe", and "Anne", I would like three columns in the grid, each with a textbox bound to each name. ...

Calling caspol.exe

I'm deploying an xbap application that runs as a full-trusted app. To get permissions on each client, I'm currently running a batch file that just calls caspol.exe. It basically just does this: %windir%\Microsoft.NET\Framework\v2.0.50727\caspol -m -ag 1 -url "http://127.0.0.1/mypath/*" FullTrust -exclusive on This works fine. However...

Jerky Animations in WPF

I have an animation in WPF that is jerky, my WPF form is layed out as follows: a 1280x800 Window contains a 2400x7** grid, seperated into 3 columns. Column 1 is * width Column 2 is 148 width Column 3 is * width This allows me to, using an animation, chage the grid's margin to ~-1000 on the left side to bring the left column off scr...

WPF Master-Details view with Listbox and Combobox with Binding

I've been looking around for an answer to my question for a few days now, but am not able to find a solution. The problem is that the combobox updates the Test object in User class with the the previous selected Users'. i.e. you select user2 and user2 has test2, you then select user5 that has test5. Now if you select user2 again, it w...

How to use the wpf treeview with nested objects of different types

I have two classes that I'd like to show in a treeview. In my main window, I have an observable collection of a certain type of object, call it object a. Object a contains an observable collection of another type of object, object b. Each object b contains an observable collection of object b's. For example, I might have something that...

Drawing a subregion of a BitmapSource

I'm creating a level editor in WPF for a 2D tile-based game. I'm trying to figure out the best way to load the tileset image file and render each tile in the appropriate location to reconstruct the map. Currently, I'm loading the image as a BitmapSource, and I'm deriving from the Canvas class for the control that displays the map. I'm o...

GUI test framework for XAML views/controls

I'm looking for a test framework that helps me test XAML views/controls. Not just to verify correct data binding but especially to test the appearance and behavior of more complex controls. Obviously this will usually result in manual tests. What I have in mind would look something like this: Write a normal unit test using whatever un...

ObservableCollection FileSystemWatcher ListBox Updating Issue

I have an ObservableCollection that is using a FileSystemWatcher to automatically add other PNG images that have been added to the directories. The ListBox has the ItemsSource databound to the Photos object using the following XAML. <ListBox ItemsSource="{Binding Source={StaticResource Photos}}" IsSynchronizedWithCurrentItem="True"/> ...

How to use custom color

In my wpf application i want to use this custom color code #7EC143 for my button background ....need help to set custom color code for background of button ...

How do you force a line break between two words in a XAML-declared Label?

Maybe I'm not using the right key words, but all my searches are coming up empty. How do you force a line break? I can tell you that none of the following work: <Label Content="Line&br;Break:" /> <Label Content="Line<br />Break:" /> <Label Content="Line Break:" /> <Label Content="Line\nBreak:" /> Can someone sh...

How to set Itemsource to a Comobox Inside a DataTemplate Dynamically?

I have one Listbox and applied one DataTemplate like this <ListBox> <ListBox.ItemTemplate> <Grid> <TextBlock Text="{Binding Path=Name}" Grid.Row=0/> <ComoboBox Name="test" DisplayMemberPath="Country" SelectedValuePath="Country_ID"> </Grid> How will I load Itemsource to this Combobox dynamically bas...

How to convert a winforms project to wpf project

I converted a Winforms project by hand-editing the proj file. Changed project type guids and added an application definition section, and now I can add WPF Windows, Pages, etc. to the project. One thing that doesn't work is, the files I added do not have autogenerated cs files, and every new window component are missing their InitializeC...

How to prevent image flickering

In my wpf application i have two pages one is .xaml form and another one is window form .cs.....Window form have three images . when i come from .xaml to .cs form i get the flickering of image effect ....but i want to stop it....help me to stop flickering . ...

Display a default DataTemplate in a ContentControl when its content is null or empty?

I would think this is possible, but the obvious way isn't working. Currently, I'm doing this: <ContentControl Content="{Binding HurfView.EditedPart}"> <ContentControl.Resources> <Style TargetType="ContentControl" x:Key="emptytemplate"> <Style.Triggers> <DataTrigger ...