wpf

Binding SQL table to DataGridView in WPF

How can I bound SQL table to datagridview in WPF? ...

WPF Stop Storyboard on Visibility Changed

Hello, I have a UserControl with a story board and I want to stop the animation when the control's Visibility changes. I created a Trigger to pause the animation and start it depending on the state, but I keep getting an ArgumentException. Here is the XAML: <UserControl.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded...

Change Notification in MVVM Hierarchies

Let's say in some abstract ViewModel base-class I have a plain-old property as follows: public Size Size { get { return _size; } set { _size = value; OnPropertyChanged("Size"); } } I then create a more specific ViewModel, inheriting from the previous one, which contains the following property: public R...

Create a Auto-sized RichTextBox in Custom WPF control (VB.NET)

I have previously used the arguments of a contentsResized event on a Winforms richtextbox to get the new size of my RTB. I am now developing a WinForms app with a custom WPF RichTextBox. My whole reason for doing this is to use the out-of-the-box spellchecker. I need my RichTextBox to expand and collapse vertically as the text is chan...

WPF TreeView not collapsing its formerly used space on collapse of root root

Hello, I have some objects with various collection properties that I'm displaying in a ListBox using a DataTemplate for the ItemTemplate. Within that DataTemplate is a TreeView which displays various properties as TreeViewItem children of a root TreeViewItem which represents the items being displayed in the ListBoxItem. My problem is ...

Silverlight vs WPF

My organization is considering which technologies to use for our next generation of systems. We will be using .NET, but have not decided which user interface technology is best. Silverlight and WPF seem to be the most appropriate options. Can someone share the pros and cons of each approach? ...

Do you know of any major gotchas with using PRISM

Hi, I am looking at implementing PRISM into my next silverlight & WPF application. I have read quite a bit about it and have implemented several sub patterns already in projects BUT I wanted to check with the community if there are any major gotcha's that other developers have come across when using the PRISM pattern that I should keep...

How can I add images to my desktop application without increasing the executable file size too much?

I'm building a desktop application and I occasionally add images to the solution explorer. When I "Build" the application, I notice the .exe file increases in size. If I add an image that's 40kb, the .exe increases 40kb. All in all, my application is currently 12mb, and I think it's a bit too much for people to download. Is there a way...

Is it possible to click a Button without ever losing focus on a TextBox?

I am trying to develop a touchscreen keyboard control in a C# WPF project that will be visible when a TextBox gets focus and is hidden when the TextBox loses focus. The projects I have seen for touchscreen keyboards have accomplished this by defining the keyboard as a new window rather than a control. For my application, I would really...

WPF Circle Packing Algorithm / Layout Control

Hi, I am looking for help on Circle Packing in WPF. Similar to the following: http://www.cricketschirping.com/weblog/2007/06/18/processing-sketch-circle-packing/ Does anyone known of a circle packing algorithm for WPF? My ideal scenario is to be able to create something similar to the IBM Many Eyes Bubble Visualization. Any help o...

wpf newbie - how to layout variable set of attributes so they appear in same columns as fixed attributes

Hi all, I am a wpf newbie & loving it. However I have a layout problem which I hope someone can help me with. I need to build a persons attributes editor. These consist of 2 fixed attributes - first name & lastname, plus a variable bucket of other attributes such as age, sex etc. I have build a dialog consists of grid which contains 2 ...

WPF binding to Listbox selectedItem

Hi, Can anyone help with the following - been playing about with this but can't for the life of me get it to work. I've got a view model which contains the following properties; public ObservableCollection<Rule> Rules { get; set; } public Rule SelectedRule { get; set; } In my XAML I've got; <ListBox x:Name="lbRules" ItemsSource="{B...

XAML/WPF: How do I bind a command to a comboboxitem.

I want to bind a command to a comboboxitem much like a typical command (either application or custom) is bound to a button. I can't seem to find an example. EDIT: The ComboBoxItem exists as part of a ContentControl that also contains a button. The button has an associated command that works well. How can I bind a command, in a simil...

How to show Adsense ads into your wpf application

I want to show ads on my Free WPF Application? Could you tell me how to do that? I just want to show ads and want to change ads after say 5minutes. ...

Implement storage of data between calls? (C# - WPF)

Hi guys, I have an ALPHA application which allows you grab an obfuscated font from and XPS file and store the .odttf file for use in Silverlight. The application "works" as in it does what it says on the tin, albeit in a very rough sort of way. In the process of cleaning this tool up to create the BETA I can across an issue. I want the...

C# cast a string to an object

In a WPF app I have objects, derived from a custom control: ... <MyNamespace:MyCustControl x:Name="x4y3" /> <MyNamespace:MyCustControl x:Name="x4y4" /> ... I can reference these objects, using names: x4y4.IsSelected = true; Also such function works well: public void StControls(MyCustControl sname) { ... ...

Trigger in template causes wrong rendering

Hi, I'm implementing my own fake tabcontrol to look like IE8-tabs (I'm aware of other implementations of tabcontrol). My TabControl derives from Selector, and my TabItems derive from ContentControl. When a tab is selected i set IsSelected (a dependencyproperty) to true. My trigger looks like this: <Trigger Property="IsSelected" Value=...

WPF Binding Issues

Hi, I'm trying to customize the TreeView control. When a user selects an item in the TreeView, I need the ActualWidth of the selected item to be stored in the item's Tag: <Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}"> <!-- ... --> <Setter Property="Template"> <Setter.Valu...

Detect whether WPF resource exists, based on URI

Given a pack:// URI, what's the best way to tell whether a compiled resource (e.g. a PNG image, compiled with a Build Action of "Resource") actually exists at that URI? After some stumbling around, I came up with this code, which works but is clumsy: private static bool CanLoadResource(Uri uri) { try { Application.GetRe...

Launch a WinForm from a WPF application

I have a WPF application which launches a WPF window. In the window, I want to double click an item in a ListView, which would open a WinForm. Will there be any side-effects in doing this? ...