How do i do this in wpf
VB.NET
Private Sub FrmSettings_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
e.Cancel = (e.CloseReason = Forms.CloseReason.UserClosing)
Me.Hide()
End Sub
c#
private void FrmSettings_FormClosing(object sender, ...
I need to import a RTF document into a FlowDocument for further parsing.. But I have a very strange problem:
public string ConvertRTF(byte[] bytes)
{
if (bytes == null)
{
throw new ArgumentNullException();
}
FlowDocument document = new FlowDocument();
// open the file for reading
using (MemoryStream str...
I have a Viewbox with an Image inside of it right now. This is great since the Viewbox will scale the Image to fit the window. However, I need to be able to zoom the image to its full size and show scroll bars and I am having a hard time figuring out how to do this.
Here's what I have right now. Can anyone give some pointers on how I ca...
Hi there, Im trying to make a recreation of MSWord using WPF RichTextBox and Toolbar, so one of the recently issues is the following:
In MSWord document...
...with Font Family Times New Roman, 11, Justify a single line contains 95 Chars
...with Font Family Times New Roman, 11, Justify, Bold a single line contains 83 Chars
about margin...
I have a ListView that I want to group results into, however the examples I am finding are not working. How can I group my results?
I want to group on the Status property in my custom object.
This is what I have:
<ListView IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding}"
HorizontalContentA...
In my application, I have a TreeView that allows drag/drop. I have all the functionality working fine, however I am having difficulty highlighting a TreeViewItem when it is dragged over. Here is my style for my treeview item. The IsMouseOver trigger does not work while dragging, because dragging seems to block other mouse events. Ca...
I read about WPF and I have following concerns: Normally when we develop applications (in my case) try to work with percentages that automatically adjusts to changes in resolution.
Currently I am developing an application to wpf apreder together to manage its operation on a 1280 * 1024 and when I wanted to see would be a resolution of 1...
I can't find the event that would get fired when a child is added or removed from a WPF panel. Does such an event exist and I am just missing it?
...
I couldn't get this to work in Silverlight, so I created two test projects. One simple WPF project and one simple Silverlight project that both do only one thing: set a public static readonly variable in code, and use it in a completely bare bones XAML. In WPF, works without a hitch. In Silverlight, I get the following compiler warni...
I'm asking this question after reading this answer on StackOverflow.
The supplied answer works great for allow you to move a whole control. But supposed I have a Usercontrol I've created like so:
<UserControl x:Class="WpfTest.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schem...
I am trying to build out a unit test and would like to fake out a DropEvent.
I get an error as it is attempting to raise the event. I can't create a DragEventArgs is it protection level is internal.
System.ArgumentException : Object of type 'System.Windows.RoutedEventArgs' cannot be converted to type 'System.Windows.DragEventArgs'
...
For a brand new application, is it better to use WPF over WinForms? I used WinForms before but not much WPF. AFAIK WPF is the successor to WinForms, right?
The application is gonna host DirectX windows (not WPF 3d, but managed dx / slimdx) with lots of custom controls.
EDIT: The application is a 3d related application, editor, such as ...
Just for kicks I'm playing around a bit with C# and WPF. I'm going through some examples on sending a button click event to a button programmatically since Button.PerformClick() is no longer present. The example I'm following is using the IInvokeProvider from the System.Windows.Automation.Provider namespace. My copy of VisualStudio 20...
I've got a WPF UserControl that works as a floating "chat window" for an application I'm writing. Basically, three rows in a grid: header, richtextbox for the chat messages, and finally a textbox for user input.
The header element has a Thumb on it so that the user can drag the chat window around inside the application. But I also need...
Hi,
I have a textbox in a WPF application bound to a property on a Linq to Entities class that implements IDataErrorInfo. The textbox binding has ValidatesOnExceptions=True and ValidatesOnDataErrors=True. When the textbox is bound to an integer property and the user enters text then the textbox outline displays as red as I haven't set...
The width property of the screen doesn't seem to update to the fully maximized width when maximizing a window. If I resize it everything works fine, but not when maximizing.
The code I have is as follows:
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
UpdateColumns();
}
private vo...
I want to Change the Format of date selected in DateTimePicker in WPF Application
...
I am trying to modify the default style of the ContextMenu in WPF.
Normally you can creat a copy of the default in Expression Blend using the Edit Control Parts (Template) > Edit a Copy menu option. However I can't work out how to do this with a ContextMenu. Any idea how I can get the default style to modify?
I am trying to disable...
Hello all,
Sorry if this is a basic question, but how can I take an ItemTemplate that I have for a ListBox, and put it in the resources for the window so that more than one ListBox can use it.
Here's some XAML:
<Window x:Class="Example">
<Window.Resources>
<DataTemplate x:Key="dtExample">
<ListBox.ItemTemplate>...
Hello there,
I'm new to WPF and its Databinding, but I stumbled upon a strange behaviour I could not resolve for myself.
In a Dialog I've got a Listbox with Users and a TextBox for a username. Both are bound to a UserLogonLogic-which publishes among others a CurrentUser property.
I want the TextBox to update its text when I click on a...