wpf

How do you clear changes in LinqToSql?

I have a combobox in my WPF app that is databound to my list of objects in my View Model. When the user makes changes to the selected object and then selects another item before saving, I need to clear the changes made. I thought I could use dataContext.GetChangeSet().Updates.Clear() but for some reason the collection is read-only. I'...

Why is my injected dependency object not the same instance in every module?

I'm using Prism and Unity. I've got this bootstrapper: protected override IModuleCatalog GetModuleCatalog() { ModuleCatalog catalog = new ModuleCatalog() .AddModule(typeof(CustomerModule.CustomerModule)) .AddModule(typeof(EmployeesModule.EmployeesModule)) .AddModule(typeof(MenuModule.MenuModule)); return...

WPF ClickOnce file issues. (XBAP/WPF/ClickOnce Gurus in.)

I am making a new Visual Studio 2008 project that integrates all the DLLS and EXEs and make it a ClickOnce Project and to publish it.The issue is that I have some XML files that store the localization data.I am adding all the files as link files to the solution project and then building and publishing. I have set for say en.xml Build Ac...

wpf databind IsVisible to TabControl.SelectedItem != null

I have a stackpanel which I want to make visible only when SomeTabControl.SelectedItem is not null - how do I do this in WPF binding? ...

Sharing state between ViewModels

I have two ViewModels that present the same Model to different Views. One presents the model as an item in a ListBox, the other presents it as a tab in a TabControl. The TabControl is to display tabs for the items that are selected in the ListBox, so that the tabs come and go as the selection changes. I can easily synchronise the two co...

TypeCast within Binding Path

I would like to perform a typecast within a binding declaration within code (C#). Here's a quick chunk of code illustrating my situation: Binding aBinding = new Binding(); aBinding.Mode = BindingMode.OneTime; aBinding.ElementName = "FullPagePageViewGrid"; //aBinding.Path = new PropertyPath("((IPageLayout)Children[0])"); // What I'd like...

WPF Databinding problem of a WCF [MessageContract] class

Hi All, I've a class on the server [MessageContract] public class RemoteFileInfo : IDisposable, INotifyPropertyChanged { [MessageHeader(MustUnderstand = true)] public string _FileName; [MessageHeader(MustUnderstand = true)] public string FileName { get { return _FileName; } set { _FileName = val...

WPF window goes black

Sometimes when i open a particular context menu on a button and then press another button the whole window goes black except for a rectangle. When i minimize and maximize or move the window to another screen the window repaints. I am registered to the button and context menu's events and it include some work like changing bounded propert...

Is it possible to change properties on a sub item in a DataTemplate using triggers from the containing control?

I want to change the background colour of the rectangle in the IsMouseOver trigger, is this possible? <Window> <Window.Resources> <DataTemplate x:Key="StackListViewItemTemplate"> <Grid> <Rectangle RadiusX="5" RadiusY="5" > <Rectangle.Fill> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0...

Retaining font size when loading/saving RTF in WPF

Consider the following RTF document {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fswiss\fprq2\fcharset0 Segoe UI;}{\f1\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs22 Sample Text\f1\fs20\par } It contains "Sample Text" in font Segoe UI 11 pt. Now when I load and then save the docume...

What is the difference between Prism's IContainer and IUnityContainer?

I've got a Prism project with code that I've gotten from various sources, everything is working quite nicely, but I noticed that in some modules I inject IContainer container and in other modules I inject IUnityContainer container IContainer only seems to have Components, Add, and Remove while IUnityContainer has dozens of methods...

How to access context menu in UserControl Resources + Infragistics Control(WPF), C#

Hi All, I have a context menu situated inside a User Control Resource. <UserControl.Resources> <ContextMenu x:Key="Menu1"> <MenuItem Header="View/Edit Contact" Command="{Binding SearchCommand}" CommandParameter="editcontact"/> <MenuItem Header="View/Edit Company" Command="{Binding SearchCommand}" CommandParamet...

How to close the home window

I'm creating a wpf application in c#, I know to close/open a window you have to use the .Close() and .Show() methods but for some reason the home screen, the first window that appears when I launch the application, won't close. Home window1 = new Home(); window1.Close(); Name window2 = new Name(); window2...

WPF vs XBAP vs Silverlight... which suits business applications?

I'm pretty familiar with a lot of the ins and outs of full fledged WPF client applications. I know that WPF client applications supports the full .NET Framework 3.5, allows for hardware acceleration of 2D and 3D graphics, theming, templating, styling, triggers, the works. What I'm not clear about is what features, and/or niceties are ei...

SubSonic 3 and WPF ItemsSource (ComboBox, DataGrid) - selected item not updating more than once

When I bind a SubSonic 3 produced IQueryable result to the ItemsSource of a WPF ComboBox or DataGrid, I'm unable to change the selected item in the ComboBox or the DataGrid more than once. I'm using SubSonic 3.0.0.3 and ActiveRecord. Here's an example: In my code: var foo = FooDB.Customer.All(); FooComboBox.ItemsSource = foo; In my...

Video and Audio Editing components

I need to write a video and audio capability in a WPF application. It need to do video and voice capture with basic editing etc. Does anyone know of any components that could get me going. ...

Resizing Thumb Template Control on Canvas in WPF.

I've dynamically placed a user control on a Canvas as the VisualTree root in a Thumb control. I can move the thumb control correctly, but can only correctly re-size the control while resizing from the east, southeast, and south rectangles defined in the user control. //Instantiate a new Thumb control to be placed on the canvas. var myTh...

WPF Application using a global variable

I created a WPF application in c# with 3 different windows, Home.xaml, Name.xaml, Config.xaml. I want to declare a variable in Home.xaml.cs that I can use in both the other forms. I tried doing public string wt = ""; but that didn't work. How can I make it usable by all three forms? ...

Binding new property on Custom Control to View Model.

Hi there, How do i extend an existing control (ComboBox in my case) to include a new property which i can bind to a property on my view model?? I have a Dependancy Property on the control's class as follows: public class MyComboBox : ComboBox { public static readonly DependencyProperty MyTextProperty = DependencyProperty.R...

Z order in between Image and InkPresenter

Hi, I have this CustomControl which contains an InkPresenter and an Image. The image has an AdornerDecorator as I plan to add an adorner to the image later on. I have set the Canvas.ZIndex of the Image to be higher than the InkPresenter so that the InkPresenter will be drawn over the Image. The problem is that when I try to collect an...