wpf

Ensuring that things run on the UI thread in WPF

I'm building a WPF application. I'm doing some async communication with the server side, and I use event aggregation with Prism on the client. Both these things results in new threads to be spawned which are not the UI thread. If I attempt to do "WPF operations" on these callback and event handler threads the world will fall apart, which...

WPF Dynamic GUI elements

In WinForms it was relatively easy to swap out Panels at runtime for other panels. In WPF this seems to be rather more complex (especially from XAML). Can anyone provide clear guidance on the 'best practice' way of swapping gui elements at runtime (think pages in a wizard type situation). Many thanks. ...

WPF container for Image template

Hi, I'm storing the urls to the images in a sql ce 3.5 database as strings. I want to retrieve the urls and display them in the main application window. Here is the code: DataSet myDataSet; private void OnInit(object sender, EventArgs e) { string connString = Properties.Settings.Default.SystemicsAnalystDBCo...

WPF ListView loaded via binding with XmlDataProvider and I want to resize columns after the items are created.

Here is my XAML: <Window x:Class="Application.SeeProductVersions" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Application.ApplicationData" Title="Product Versions" Height="300" Width="640" Loaded="Window_Loaded...

Get RowDefinition height programatically

I have this XAML: <Grid Background="LightYellow" Height="150" Width="150"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> </Grid> And I'm trying to get the height of the second row like this: height = grid.RowDefinitions[1].Height.Value...

Wpf Popup Window Alternatives with a DataGrid

I have a presentatation based around a DataGrid, one of the features being access to a picklist of options for adding new line items (projects) to the grid. The picklist dialog shows 2 columns of data and provides search / filter options to find the right project out of 150 or so choices - too much to use a grid combo box! I was thinkin...

WPF - VisualStateManager - How do I?

Hello, I Have two states within my VisualStateManagerGroup: "VisualStateLogin". How do I go from the Base state to another when my Window is loaded? I Have tryed it: public MainWindow() { this.InitializeComponent(); //Initializes the mainwindow in a user loogedoff state this.Loaded += new RoutedEventHandler(MainWindow_Loaded); } vo...

Saving User Config data to XML and Relative URI error

Good evening, I am working on a program where some application config info is stored in a Userconfig.xml file. I am loading the file as an XMLDataProvider in the XAML via relative URI: <XmlDataProvider x:Name="UserConfigDataSource" x:Key="UserConfigDataSource" Source="UserConfig.xml" d:IsDataSource="True"/> I have a number of items ...

CollectionViewSource is filtered?

What's the easiest way to know if the view is currently filtered or not? I want a clearAll type of command that is only is displayed when there is something to clear. Thanks! Berryl ...

WPF Custom Window Flashing

I've a custom window created in WPF, and I'm showing this window using ShowDialog() method. How do I flash this window when user tries to click the parent window without dismissing dialog window? ...

WPF UserControl swapping and preserving keyboard focus

I've got a WPF window where I have a column of buttons on the left side. On the right side I am show/hiding UserControls as the left hand buttons are clicked. I have created the UserControls once and then just switch between them with the buttons. As I switch I would like to retain the keyboard focus where it was when that UserControl w...

Creating a Scrollable StackPanel Control

How would I create a control like the example at this site as a User Control? So, instead of doing this: <ScrollViewer> <StackPanel> <!– Content –> </StackPanel> </ScrollViewer> I could do this: <ScrollableStackPanel> <!– Content –> </ScrollableStackPanel> ...

WPF CLR Type to UIElement

Hi, I am trying to solve a complicated problem. I am building a dynamic interface and want to convert any existence of ArrayList into a TreeView. I tried value converter but It did not work. Here is my code: if(current.Value is ArrayList) { var factory = new FrameworkElementFactory(typeof (TreeV...

Problem with customized installer

We have created customized installer using Visual studio 2008 installer and in BeforeInstall method we are calling a splash screen. The problem here is when we click on setup.exe to start the installation it takes almost 25 sec to show the splash screen. Can you please let me know if there is any way to reduce this time or any other alte...

WPF combobox colors

I'm changing the look of all ComboBoxes in my application by adding this style to App.xaml: <Style TargetType="ComboBox"> <Setter Property="Foreground" Value="White"/> <Setter Property="Background" Value="#303030"/> <Setter Property="BorderBrush" Value="#000000"/> </Style> There are two colors that I ha...

Using WPF UI thread should always ensure STA apartment mode, right?

In my WPF application I communicate asynchronously with a server. The callback will hence not be run in the UI thread, and as I need to do some WPF stuff there (create InkPresenter object) I need it to be run on the UI thread. Well, actually the requirement is that it is run on a thread with STA apartment mode. I tried creating a new thr...

Wpf: Image Control does not support .TGA files

In my application I am using Images, these images can be .tga(Targa Graphic) file as well, when I am creating instance of BitmapImage using .tga file, it throws exception saying "No imaging component suitable to complete this operation was found.". Is there any other way to work with .tga file in wpf? How can I use these(.tga) files jus...

wpf with sqlight database

Dear All Any Wpf Sample application is there with Sqlight database for just refrence purpose. ...

WPF Designer Popup Content Display

Happy friday folks, awesome. I am currently writing a small tooltip mimicking control to display inline help in an application. I was going to just use standard tooltips but decided that I potentially wanted interactivity. I have it working no problem. Its quite literally an implementation of ContentControl with a ControlTemplate trigg...

Dealing with WPF objects inside ViewModel

Using the MVVM pattern creating WPF applications you have the ViewModel providing data to the View. I've met a situation where I find it reasonable to create WPF objects in my ViewModel, and the View fetches these and shows them. More specifically I have functionality for drawing where I need to store an InkPresenter in the end. I receiv...