wpf

Strange WPF errors in Visual Studio

Does anybody know of the reason why ""could not create instance of UserControl"" error can occur. It seems to me that it occurs completely spontanous, for example after I add space after node or change tabulation. Maybe it's some kind of VS bug? Here are controls. This configuration actually raises an error <UserControl x:Class="Shortc...

When binding with Wpf is there a way to use System.String funcntions without using converters?

When binding with Wpf is there a way to use System.String funcntions without using converters? <TextBlock Text="({Binding Path=Text}).Trim()"/> that's basically my desire. ...

Does WPF/Xaml have something like Flex/MXML's ViewStack

ViewStack in Flex/MXML is a container/panel control that holds multiple children but only makes one visible at a time, useful for implementing your own tab-style controls. Does WPF/Xaml have a class that works the same as this? I know it has its own dedicated tab control (what I'm trying to do isn't really a tab control, so not useful)...

Emulating the Vista notification icon dialog boxes with WPF

When single-clicking a notification icon in Vista (such as the network or sound icons) you are presented with a bordered yet captionless dialog (http://i.msdn.microsoft.com/Aa511448.NotificationArea22(en-us,MSDN.10).png): How can I emulate these in WPF? Creating a new window and setting WindowStyle to "None" and ResizeMode to "CanRes...

Reference Access database dataset.designer file in WPF?

Hey, I've included an MS Access database in my WPF VB app, and I'm trying to link the data to an XCEED Datagrid. I have the following code in my testerDataSet.Designer.vb file which I assume is the funcion I should be referencing Public ReadOnly Property Contact() As ContactDataTable Get Return Me.tableContact End Get En...

How can I search for an element in a treeview with linq?

I'm searching for a linq-to-objects way to get a TreeViewItem from a treeView. I want to do something like this: var node = from TreeViewItem childs in tree.Items where ((int) childs.Tag) == 1000 select childs; string tag = ((TreeViewItem)node).Tag.ToString(); Then I want to append children t...

How to disable shortcuts in WPF TextBox

I wan't to disable all default shortcuts in WPF TextBox. Shortcuts like Ctrl+A, Ctrl+V, Ctrl+C etc. Can this be done?. It looks to me that these shortcuts are executed before KeyDown event ...

Problem with Binding Close Command to Button in a Tabcontrol datatemplate

Im Using Composite Aplication Guidiance Pattern for building my WPF application. In my Shell i have a tabcontrol wich contains a region for dynamicly load Views into the region. The views is loaded into new tabs in the TabControl. <TabControl AutomationProperties.AutomationId="MainTabControl" cal:RegionManager.Region...

MarkupExtension as computed property in Template

Having such MarkupExtension public class Extension1 : MarkupExtension { private static int _counter = 0; public override object ProvideValue(IServiceProvider serviceProvider) { return string.Format("Item {0}", _counter++); } } and this XAML <ListBox> <ListBoxItem Content="{my:Extension1}"></ListBoxItem> <...

How do I add an extended class ScrollViewer to the XAML file?

I was looking for a way to animate the scrolling of a ScrollViewer and I found a sample, but when I try to add the class to the XAML file I get an error: Error 2 The type 'AniScrollViewer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. this is the c...

WPF soft phone control

We have a custom built WPF CRM and are looking to integrate a soft phone client so that operators don't have to manually enter phone numbers. From what I can see on the web there are no WPF soft phone clients and it looks like we'll have to build our own from scratch. Does anyone know of any WPF soft phone implementations out there? I ...

WPF Combobox bug when form allowtransparency=true

I have found the following in WPF: I have a form with AllowTransparency=true. Inside the form I put a Combobox. I add some items to the combobox. I run this application and click on the combobox. At first it does not seem to appear at all. On closer inspection (after adding more items) I see that it is actually appearing behind the for...

Why isn't my WPF Datagrid showing data?

This walkthrough says you can create a WPF datagrid in one line but doesn't give a full example. So I created an example using a generic list and connected it to the WPF datagrid, but it doesn't show any data. What do I need to change on the code below to get it to show data in the datagrid? ANSWER: This code works now: XAML: <Wind...

How do I convert a string like "Red" to a System.Windows.Media.Color?

I know I can go the long route by... Adding a reference to System.Drawing Creating a System.Drawing.Color from the string Creating the System.Windows.Media.Color from the ARGB values of the System.Drawing.Color. But this feels like serious overkill. Is there an easier way? ...

In WPF, why does the Rectangle.Fill property not seem to work when using a TemplateBinding?

I can't figure out why this XAML code does not work. When using a TemplateBinding (see below), the background color is not set. But when I use a normal color string (i.e. "Red"), it works fine. <ControlTemplate x:Key="InstanceButtonTemplate" TargetType="{x:Type Control}"> <Grid> <Rectangle> <Rectangle.Fill> ...

Can't convert Resource to string using TypeConverter

Exception: Cannot convert the value in attribute 'Text' to object of type 'System.String'. Unable to cast object of type 'MyApp.Foo' to type 'System.String'. XAML: <Window.Resources> <my:Foo x:Key="foo"></my:Foo> </Window.Resources> <TextBox Text="{DynamicResource foo}"></TextBox> C# [TypeConverter(typeof(FooConverter)...

how can I enable scrollbars on the WPF Datagrid?

When I run the following Northwind WPF Toolkit Datagrid code from this article, I get a datagrid, but there are no scrollbars and hence the user can only see part of the datagrid. I am using the newest version March 2009. What do I need to specify so that the WPF Datagrid has scrollbars? I tried putting the datagrid in a ScrollViewer ...

WPF - Can't set focus to a child of UserControl

I have a UserControl which contains a TextBox. When my main window loads I want to set the focus to this textbox so I added Focusable="True" GotFocus="UC_GotFocus" to the UserControls definition and FocusManager.FocusedElement="{Binding ElementName=login}" to my main windows definition. In the UC_GotFocus method i simply call .Focus() ...

Binding Controls to more than one DataTable

This is probably an odd question but here I go (do let me know if this is a bad database design or just a weird situation I'm in). I have two tables in my database: ProductGroup and Parameters. One contains information about various product groups as per its name and the other one contains information about various parameters that can b...

How to do get this CRUD code to work on WPF DataGrid?

I'm writing CRUD code for the WPF Datagrid. In the TheDataGrid_CellEditEnding method below: how do I get the original text before the user made the change? I need the original text to be able to change the customer and save it back to the database with _db.SubmitChanges() Here's the full solution with database if anyone wants to exp...