wpf

How to get an ItemsSource to refresh its bind?

I've got a view which shows a listbox that is bound to GetAll(): <DockPanel> <ListBox ItemsSource="{Binding GetAll}" ItemTemplate="{StaticResource allCustomersDataTemplate}" Style="{StaticResource allCustomersListBox}"> </ListBox> </DockPanel> GetAll() is an ObservableCollection property in my ViewMod...

WPF - How can I center all items in a WrapPanel?

I'm using a WrapPanel as the ItemsPanel of an ItemsControl. Right now, the items in the control wrap like this: |1234567 | |890 | I'd like them to wrap like this: | 1234567 | | 890 | Conceptually, the layout process should align each line of items such that it's centered within the WrapPanel's bounds. Can someone explai...

WPF ItemsControl data binding - adding extra initial controls

I have the following XAML for a databound items control to show a list of groups, with a label and button to add a new group appearing first: <WrapPanel Orientation="Horizontal"> <Label Content="Groups" /> <Button x:Name="btnGroupAdd" Click="btnGroupAdd_Click" Content="+" /> <ItemsControl ItemsSource="{Binding}" x:Name="_groupList" >...

How do I handle/edit large amount of text in WPF?

What would be a good approach to display and edit large amount of unformatted text (just like notepade does) using WPF? Loading a big string into a TextBox makes the UI unresponsive. The overall performance is not nearly comparable with TextBox Controls of previous Microsoft UI Frameworks. What options do I have to solve this problem. ...

How do I apply an effect to a Border but not to its contents in WPF?

I have a WPF application that has a 3rd party data grid with a border around it. I've used the DropShadowEffect to put a shadow behind the border, but this seems to affect performance somewhat (not nearly as much as a BitmapEffect, but still noticeable) and makes the font rendering fuzzy. Is there a way to somehow apply the effect to t...

WPF - How can I make a brush that paints graph-paper-like squares?

How might I create a brush that paints a regular, repeated grid of 1-unit thick lines spaced evenly in both the horizontal and vertical axes? Imagine graph paper, if you will. Ideally the solution would allow control over the brushes used for the lines and the background (the regions within the squares). In this way the background cou...

What property returns a string's value from a string object (for binding)?

I have a converter that takes a string as input and returns an icon. It's used to provide a icon that is used in a list box. When the itemsSource is set to a list whose items have a property that returns a string, the XAML looks as follows: <Image Source="{Binding FileName, Converter={StaticResource FileNameToIconConverter}}"/> That i...

WPF: What is the difference between a User Control Library and a Custom Control Library?

I am just coming up to speed on WPF and would like to create a reusable WPF control. When I look at the options for creating projects in Visual Studio, I see "WPF User Control Library" and "WPF Custom Control Library". It's unclear to me what the difference is between them and my Google searches have not turned up any decent explanat...

How do I create a C# app that decides itself whether to show as a console or windowed app?

Is there a way to launch a C# application with the following features? It determines by command-line parameters whether it is a windowed or console app It doesn't show a console when it is asked to be windowed and doesn't show a GUI window when it is running from the console. For example, myapp.exe /help would output to stdout on the...

determine if a wpf dependencyproperty value is inherited

Does anyone know how to determine if the value of a WPF property is inherited? In particular, I'm trying to determine if the DataContext of a FrameworkElement was inherited from the parent or set directly on the element itself. Thanks, - Mike ...

WPF app into ASP

Is there any way to turn to WPF app into an ASP app? Or are they totally unrelated technologies? XAML format reminds me so much of HTML that it seems like there might be a way. Thanks. ...

.NET WPF MissingMethodException when launching new thread

I have a WPF application with a form that, when started, invokes a custom method in a new thread. Private Sub TestStep1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded Dim oThread As New Thread(AddressOf DisplayNextPicture) oThread.Start() End Sub Private Sub DisplayNextPicture() ...

How to programmatically navigate WPF UI element tab stops?

Can anyone tell me how to programmatically navigate through all UI element tab stops in a WPF application? I want to start with the first tab stop sniff the corresponding element, visit the next tab stop, sniff the corresponding element, and so on until I reach the last tab stop. Thanks, - Mike ...

WPF: Jump/navigate to next data error using programmatic keyboard focus navigation

I've built a WPF application. All of the UI elements except the Window are created in response to data binding. Thus, I set the DataContext of the Window, and voila -- a very large hierarchy of UI elements materializes on the screen. The UI contains lists of panels with lists, labels, more panels, textboxes, checkboxes, you name it. ...

Locating the first WPF tab stop

Thanks to an answer on a previous question (Previous Question), I now have a body of code that navigates WPF tab stops (shown below). It works fine except for the first tab stop. Calling this.MoveFocus(...First) and followed by FocusManager.GetFocusedElement returns null. Any ideas? How do I get the first tab stop in my window? Than...

WPF WindowsFormsHost VS2008 Toolbox has grayed out all the Windows Forms controls

I'm trying to use WindowsFormsHost in a WPF app so I can use some Windows Forms components. <Grid> <WindowsFormsHost> </WindowsFormsHost> </Grid> This all works ok with no errors, but when I go to drag a Windows Forms component from the toolbox in VS2008, they're all grayed out. In a way this makes sense as only the WPF compo...

WPF: Is there an event that is fired when the user presses the close button [X] ?

Is there an event that is fired when the user presses the close button? This is because the Window Closing event is fired both when one closes the window manually (with the Close method) and also when the user presses the [X] button...but I somehow need to know only when the user presses the [X] button not when the window is closed manu...

How to stop a WPF binding from ignoring the PropertyChanged event that it caused?

I have a TextBox bound to a ViewModel's Text property with the following setup: Xaml <TextBox Text="{Binding Text}"/> C# public class ViewModel : INotifyPropertyChanged { public string Text { get { return m_Text; } set { if (String.Equals(m_Text, value)) ...

Passing a parameter using RelayCommand defined in the ViewModel (from Josh Smith example)

I would like to pass a parameter defined in the XAML (View) of my application to the ViewModel class by using the RelayCommand. I followed Josh Smith's excellent article on MVVM and have implemented the following. XAML Code <Button Command="{Binding Path=ACommandWithAParameter}" CommandParameter="Orange" ...

WPF application is not closing correctly

Hi, I am calling Application.Current.Shutdown method from class that is binded to xaml windows with objectdataprovider, but the application is not closing, can anyone help me to understand why? And i note that my application is not closing completely after my main window is closed, it doesn't disappear from task manager's process list....