wpf

Is there a way to switch from Fulltrust to PartialTrust at Runtime? (WPF)

I don't want my WPF application to run in Fulltrust but it's impossible to run WPF in a partial trust AppDomain (i tried even with WPF hosting/interop) and WPF Browser Application does not fit my needs, so my question is: is there a way to change the SecurityZone of the current AppDomain at runtime after WPF has created the Window and ...

wpf datagrid cell content changes, when it's not supposed to

Hi, I have a textbox which, when typing in it, selects the Item in my WPF datagrid with the matching item, however, it changes the first item as well to what is typed in the textbox before going to the matching item in the grid. I'm not sure how that is possible? Can someone help find what's wrong? The search is only performed on the...

How to add LINQ to SQL query results to Observable Collection?

In WPF app I have an Observable Collection which is connected through databinding with ListView. I would like to populate this Observable Collection from LINQ to SQL query, but with no success. In fact my code even doesn't compile (I pointed out the problem lines with comments). The structure of underlying Observable Collection Class i...

How to use PropertyChangedEventHandler of LINQ to SQL class for immediate updating?

In my WPF app I have implemented LINQ to SQL query which populates an Observable Collection connected with ListView. It is in this method which I can call from somwhere and it works OK: private void VisualizeAllShows() { MyfirstdbDataContext context = new MyfirstdbDataContext(); _ShowQuCollection.Clear(); var sh = from p i...

Make individual checkboxes on WPF datagrid not visible

I have a datagrid bound to a CollectionViewSource view in my view model. The datagrid has a CheckBoxColumn and three TextColumns, each bound to properties in the items in the view. I also have a bool property "Enabled" in the view item that I would like to use to make checkboxes in individual rows not visible. As an added bonus, it wo...

Inverse WPF Transformations

I'm working on a WPF image viewer which needs to allow for rubber band selection after an image has been transformed. I've got it working for zoom and transformation, but when the image is rotated, the selection's top left position is wrong. I've tried a couple of ideas to fix this with some basic trig functions, but i just can't seem t...

WPF relative path problem

I have created a custom TaskButton control that takes an image and text. The properties are set like this: <custom:TaskButton Text="Calendar" ImagePath="Images/calendar.png" ... /> My custom control class implements Text and ImagePath properties, and the control template for the custom control (in Themes\Generic.xaml) sets its content...

c# wpf 2d graphics - Looking for tutorial / examples

Hello ! Could you please point me to a good C# tutorial for drawing 2d graphics like Ellipse and Rectangle (that inherit from Shape) on a Canvas using WPF ? I'm also interested later to click on shapes and identify which shape was clicked, and also to drag and drop shapes on the canvas. Thank you ! ...

What is the best way to remove a layout element

I have a progress bar shown as I am loading images with the webclient object asynchronously. Once the images have been downloaded I set the loadingComplete bool property to True in my viewmodel to indicate that the loading process has been completed. Currently I am using this value for an attached property to set focus on a control. Wha...

DateTime region specific formatting in WPF ListView

In WPF app I have a ListView: <ListView Height="100" Width="434" Margin="0,2,0,0" x:Name="lvItems" ItemsSource="{Binding ElementName=MainWindow, Path=ShowQuCollection}" > <ListView.View> <GridView> <GridViewColumn Header="Date" Width="100" DisplayMemberBinding="{Binding Date}"/> <GridViewColumn Header="Time" Width="100" ...

Dynamically change the content of of control based on a value

Hi I want to achieve the following behavior: Depending on a value use a different datatemplate: <DataTemplate x:Key="cardTemplate2"> <Border x:Name="container"> ..... </Border> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Show...

Effect of using more video memory than physically available (WPF)

I have a WPF application which uses large amounts of frame based animations (100's MB worth of PNGs). Using the WPF Performance Suite tool "Perforator" I can see that, at times, the video memory being used is greater than is physically available on the GPU (512MB). I understand that GPU memory is virtualized from Vista onwards (>WDDM 2...

Binding a combobox's selected item and items list to different properties in wpf

Question: How do you set the binding for a ComboBox's Selected items to one property and the items list to a different property? Info: I have an inventory program I'm working on for my company which is aimed mostly at the people who receive shipments as they come in. I have things set up so that there is a list of shipments on one si...

Window.Margin & Window.Padding don't work

hello. I am setting peroperty Margin and Padding of a window and it doesn't take effect: Here is an example: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" SizeToContent="WidthAndHeight" ResizeMode="NoResize" Padding="22" Margin="...

Wpf Listbox Listboxitem

I have a listbox that uses a datatemplate. What I need is a way after the item is selected I want to shrink the listbox itself, not the listitem inside. I have tried the eventtrigger on the selector.selected and unselected but it doesn't fire. I also put a datatrigger on the datatemplate but I cannot access the listbox from here. Any Ide...

Can I update the UI from a LINQ binding?

This little bit of code will help me describe my problem: public class Car { ... } public class CarQueue : ObservableCollection<Car> { public IEnumerable Brands { get { return (from Car c in this.Items select c.Brand).Distinct(); } } } Ok now I have an instance of CarQueue class bound to a DataGrid. When I add...

How to automate Microsoft word 2003 from WPF?

I have a WPF window( using c# as code behind) that has some text fields, and I want when the user press print button take the information on these fields and use Microsoft word 2003 template that has some blank fields to be filled with these info coming from WPF widow. How would I automate word to do this? ...

Updating front-end WPF app from a SQL Server database

Please, help me clear my mind on the following question. Recently I asked a question on SO, about possibility of immediate updating WPF classes from SQL Server DB through LINQ to SQL: http://stackoverflow.com/questions/1991455/how-to-use-propertychangedeventhandler-of-linq-to-sql-class-for-immediate-updatin from the answers I got know...

Binding FontStyles and FontWeights to WPF ComboBox

I was just wondering if it would be possible to bind the list of available FontStyles and FontWeights to a ComboBox? For example, to bind the list of fonts to a combobox you can use: FontComboBox.ItemsSource = Fonts.SystemFontFamilies; Can I also have something for : FontStyleComboBox.ItemsSource = .... FontWeightComboBox.ItemsSourc...

C# WPF: Using Generic Views: Not Possible?

I am new to WPF, have read some books about it, but now I am stuck. I have a generic class and a few concrete implementation of it public class Question<T> { List<T> AvailableAnswers; T Correct Answer; MidiSound SoundFragment; String Question; } public class IntervalQuestion : Question<Interval> public class ScaleQuest...