wpf

Closing WPF MainWindow

Hey Everyone, I have a login dialog being displayed in a WPF application that has a cancel button on it that instead attempting to log into the application, closes it down. The problem is, I have a user control that appears on the mainwindow form, so if I attempt to run the Application.Current.Shutdown() or this.Close() methods, I get a...

Is there a way to call external functions from xaml?

Is there any way to call methods of external objects (for example resource objects) directly from xaml? I mean something like this: <Grid xmlns:dm="clr-namespace:MyNameSpace;assembly=MyAssembly"> <Grid.Resources> <dm:TimeSource x:Key="timesource1"/> </Grid.Resources> <Button Click="timesource_updade">Update time</But...

Move UIElement in Visual Tree without recalculating layout

We have a WPF application (.Net 4.0) using a Docking Control (Actipro). We can dock out the docking windows. In that case, a "real" Window is created and the content is assigned to that window. Of course, moving stuff in the Visual Tree will re-trigger the complete layouting. This is problematic, because in one of these docking windows,...

Using dependency property in WPF

I have a readonly .NET property exposed from a managed wrapper which gets the name of the database, let's say the property name is DBName. The DBName may vary depending upon the database connected to the WPF application. This property getter and setter also resides inside the managed .NET wrapper. I am using this(DBName) property in my...

Disable clicking through other controls - WPF

Hello. I have Simple application. <Window x:Class="WpfControlReview.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlfo...

How to mix Grid columns and ItemsControl features?

I'm looking for easies way to create Listbox/ListView/ItemsControl where each item will be Grid's row. I have simple tree structure (depth=3) Group -> Question1 ->Answer11 ->Answer12 -> Question2 ->Answer21 ->Answer22 ->Answer23 and i'd like to present it as Table. QUestion1 | Answer11 | Ans...

Tweak WPF application performance which hosts hundreds of similar controls

Hello, We just ported our WinForms application to WPF. However, performance decreased dramatically. We have a User Interface which consists of about 200 UserControl. Each UserControl is defined by a DataGrid (= 10 columns and 3-15 rows) as well as a Panel which hosts about 10 Buttons. They are all hosted in a ScrollViewer. (Please do...

wpf databinding to a property of same control

I have a control (let's say a textbox) and I want bind the value of one property (let's say tooltip) to value of another property in same control(let's say text). i want something like belowing but I dont know how can I bind the tooltip to text of same control : <textBox text="abc" tooltip={Binding ???} /> ...

DataGrid's CellEditingTemplate and focus in edit mode

I am having an issue with WPFToolkit DataGrid when a column is customized supplying both CellTemplate and CellEditingTemplate. If you take a look below, you will see my editing template has a single CheckBox. All is fine in a functional sense but when F2 is hit to edit the cell, one must also hit TAB in order for the CheckBox to receive ...

wpf - binding stringformat on label using string literal

I've binded the tooltip of a slider control to it's Value property and i'm trying to use StringFormat to make it display "Current Value {0} of 10" where the {0} is the Value property. Below is one of the various things I tried when trying to figure this out. <Slider.ToolTip> <Label> ...

Leveraging WPF's CombinedGeometry in code.

I have a requirement for 2D geometric boolean operations in a non-WPF application. I know you can use WPF assebmlies in a non-WPF application. Can the CombinedGeometry and PathGeometry object be used to perform boolean operations on geometric data? Currently I am doing my boolean operations manually, and it is very unstable. I was ho...

How can I prevent system clipboard image data being pasted into a WPF RichTextBox

I have some code in place currently to intercept all Cut, Copy and Paste events into a RichTextBox in WPF. These are designed to strip all content out except plain text, and allow no pasting except plain text (by using a check the Clipboard.ContainsText() method.) This seems to be successful at preventing all such operations from inside ...

Sorting a ListView by deriving GridViewColumnHeader

I am trying to implement a ListView with a GridView with sortable columns. To sort the ListView I hook up the Click event for the GridViewColumnHeaders and adding SortDescriptors to the default view source (similar to what is done in MSDN). Something like this: <ListView ItemsSource="MY ITEMS SOURCE BINDING"> <ListView.View> ...

What kind of windows applications can receive system events?

What kind of windows applications can receive system events? I mean events like closed by user. Windows forms, WPF applications and Windows services can do that. But I am not aware of any others. ...

WPF 4 ContentPresenter TextWrapping style is not applied to implicitedly generated TextBlock

If I assign a piece of text to the Content property of a ContentPresenter a TextBlock control is generated by the ContentPresenter at render time to contain that text. If I create a style that applies to TextBlock properties and assign it to that ContentPresenter, the does not appear to apply to the implicitly generated TextBlocks. <St...

How to make security on wpf software?

How do I have a research implement on wpf software? ...

WPF Add a Border to a TextBlock

Is it possible to add a border to a textblock. I need it to be added in the setter property below code: <Style x:Key="notCalled" TargetType="{x:Type TextBlock}"> <Setter Property="Margin" Value="2,2,2,2" /> <Setter Property="Background" Value="Transparent" /> </Style> ...

How to bind images to a Combobox in WPF, getting the images from a lookup.

I have a WPF combobox that I would like to bind to an observable collection of Teams on my ViewModel class e.g. class Team { public int Id { get; set; } public string Name { get; set; } public int CountryId { get; set; } } class ViewModel { public ObservableCollection<Team> Teams { get; set; } public IDictionary<int, Image...

WPF Fade out status bar text after X seconds?

I'm trying to come up with an unobtrusive way to to display minor error messages to a user. So I've added a statusbar to my form, <StatusBar Margin="0,288,0,0" Name="statusBar" Height="23" VerticalAlignment="Bottom"> <TextBlock Name="statusText">Ready.</TextBlock> </StatusBar> And then when they click an "Add" button, ...

Binding evaluation after UI is visible.

Hi All, Here is my scenario. I have usercontrol, uc1. In uc1 i have listbox on which ItemTemplateSelector is defined and it is pointing to different DataTemplates having other usercontrols eg. uc2, uc3 etc... Items in listbox are getting updated when UI is visible. I mean, I can see for eg. in a list box item first arrow comes up, th...