wpf

Rendering an image at runtime in WPF

Hello, I have posted several questions related to this problem I am having and I am starting to believe this cannot be done. Here is the back story. I have an ASP.NET application from which I want to generate a .png image. This .png image needs to be constructed from either XAML or a WPF Visual Tree. Because of this, I must generate th...

WPF and LINQ to Entities binding to newly added records

I'm in the process of learning LINQ to Entities and WPF so forgive me if I get some terminology wrong. I have a model which contains Clients and I want the user to be able to bulk enter up to 20 clients at a time (this will be done by data entry staff off a paper list so I want to avoid entering one and saving one). I was planning on a...

Adding the xaml file in ASP.net web Application

How to add the xaml file in ASP.net web page. ...

How can I bind a List collection to TabControl headers in WPF?

I can get data into my TabControl but the headers have frames around them and I can't slick from tab to tab. What am I doing wrong with the XAML binding syntax on this TabControl? XAML: <StackPanel> <TabControl x:Name="TheTabControl"> <TabControl.ItemTemplate> <DataTemplate> <TabItem Header="{B...

In WPF, what are the differences between the x:Name and Name attributes?

The title says it all. Sometimes it seems that the Name and x:Name attributes are interchangeable. So, what are the definitive differences between them, and when is it preferable to use one over the other? Are there any performance or memory implications to using them the wrong way? EDIT Responses so far suggest that using x:Name al...

A TwoWay or OneWayToSource binding cannot work on the read-only property.

I've a read only property I need to display in a textbox, and getting this error at runtime. I've set IsEnabled="False" IsReadOnly="True" - no luck. Other searches say the readonly should fix it, but not for me. I've got an ugly workaround by adding a dummy setter... ...

Making sure OnPropertyChanged() is called on UI thread in MVVM WPF app

In a WPF app that I'm writing using the MVVM pattern, I have a background process that doing it's thing, but need to get status updates from it out to the UI. I'm using the MVVM pattern, so my ViewModel knows virtually nothing of the view (UI) that is presenting the model to the user. Say I have the following method in my ViewModel: p...

WPF Binding to ObjectDataProvider Method and detecting return value dependencies

I'm binding to a method using an ObjectDataProvider. The class which exposes this method contains an ObservableCollection of type T:INofifyChanged. My problem is that because the methods return value is dependent upon the value of it's ObservableCollection, i need the binding to be updated when the ObservableCollection changes in any w...

Why can I bind to ListBox but not to DataGrid in WPF?

I set up LINQ-to-SQL / NorthWind in WPF. The ListBox shows data but the DataGrid doesn't (no errors, just doesn't display anything). I referenced WPFToolkit.dll. Why is the DataGrid not displaying the data that ListBox can? XAML: <Window x:Class="TestLinq343.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentati...

WPF List View Sort on Load

Here is the problem: I want to sort a ListView when it is first loaded. I have implemented the functionality where in the List View can be sorted if the Header columns in the ListView are clicked. I unable to find a suitable event which I can use to call my sort function. I tried using OnInitialized of the UserControl and Loaded events...

My images are blurry! Why isn't WPF's SnapsToDevicePixels working?

I'm using some Images in my WPF applcation. XAML: <Image Name="ImageOrderedList" Source="images/OrderedList.png" ToolTip="Ordered List" Margin="0,0,5,5" Width="20" Height="20" SnapsToDevicePixels="True" MouseUp="Image_MouseUp" MouseEnter="Image_MouseEnter" MouseLeave="Image...

Expression Blend Books?

Are there any good Expression Blend books out there yet? The help file is better than I'd expected it to be. But I'd really like to get ramped up faster. ...

How can I bind a dataset directly to a TreeView (with hierarchy)?

If I have a DataSet as a result of a SQL query, can I bind it directly to a TreeView and show the hierarchy of my data? I know I'd have to use several HierarchicalDataTemplates, but I don't know how to tell each one what data to display. If I have a 4-level hierarchy, like so: <HierarchicalDataTemplate x:Key="FirstLevelTemplate" ItemTe...

Select TreeView Node on right click before displaying ContextMenu

I whould like to select a WPF TreeView Node on right click, right before the ContextMenu displayed. For WinForms I could use code like this http://stackoverflow.com/questions/2527/c-treeview-context-menus, what are the WPF alternatives? ...

WPF ComboBox not updating source

I'm trying to get a WPF combobox working (inside the WPFToolkit Datagrid), and I'm having trouble getting all the pieces aligned correctly. I'm using Linq to Entities, and I'm setting the overall datacontext to the results of a Linq query: private void LoadDonationGrid() { donationGrid.ItemsSource = from donations in entities.Don...

WPF: Remove dotted border around focused item in styled listbox

I have a horizontal listbox with a custom controlIemplate. The selected item gets a dotted frame when focused. Anyone know how to get rid of it? ...

WPF WebBrowser Overwrite Javascript

Hi, I work with WPF WebBrowser control which different from WinForms and many recommendations from this excellent web site simply does not work in WPF. I try to find solution how I can overwrite particular javascript function btnSubmit_onclick() on a web page. This function generates confirm dialog (like "Are you sure?") which I want t...

WPF: Listbox, centering selected item

Is it possible to always keep selected item in the middle of a listbox? If the user selects an item, I want to scroll so that the newly selected item is in the middle. I guess it want be possible for the 'edge cases' (the first and last few items), but that's ok. ...

Why e.Source depends on TreeView populating method?

I have two trees: fooTree - made up of elements, barTree - constructed by Both trees have MouseRightButtonDown event, but the e.Source type differs: fooTree - System.Windows.Controls.TreeViewItem barTree - System.Windows.Controls.TreeView Why e.Source differs? Also, how can I get the clicked item for the barTree? Markup: ...

How do i read a base64 image in WPF?

I know how to do it in WinForms byte[] binaryData = Convert.FromBase64String(bgImage64); image = Image.FromStream(new MemoryStream(binaryData)); but how do i do the same thing in WPF? ...