wpf

How can I get a TextBlock to literally say "{Binding}"?

In XAML, if you insert <TextBlock Text="Hello World" /> You will see the words "Hello World". If you insert <TextBlock Text="{Binding}" /> it will trigger the data binding functionality. But what if I really wanted the display text to be "{Binding}"?" Are there the equivalent of escape characters in XAML strings? Or is my only s...

How can print text file in WPF

I have simple text file, and i have to print it using WPF. How can i print this file with specified printer setting(like margin, print on both side). ...

Prevent WPF Window From Minimizing (Winkey + D, mostly)

Hi I have a window which is supposed to act like a Windows Vista(+) gadget; its supposed to stay on the desktop, not to appear on taskbar and the alt+tab menu, but most importantly, not to get minimized. Here is its header: As its style is set to None, it has no control buttons (minimize, close, etc...) but it still can be minimized...

How to localise WPF application so that right to left languages are displayed correctly?

What steps are required to localise a WPF application so that right to left languages are displayed correctly? ...

Check for overlapping shapes in WPF

Hi, I have a set of shapes which need to be drawn on top of each other. I need to re-order them such that the smallest shape gets drawn last (i.e. it will be closest to the user). Is there any way to check whether a shape overlappes (encloses and/or intersects) another shape. I know there is a method in Rect structure called Contains wh...

How to reference objects in one UserControl from code in a second control

In one UserControl I have option buttons that are supposed to change the visibility of rectangles in another user control and I can't find out how to do this. Can anyone give me some code example for this? ...

Use Application.Resources in Class

Hi. I do not know how to use a defined Application Style Resource in code. I have defined: <Application.Resources> <Style x:Key="OrangeButton" TargetType="{x:Type Button}"> I am using this resource in the XAML section of my application like: <Button Name="Button_Start" style="{StaticResource OrangeButton}" Margin="0"> and it is wor...

What's the point in setting up dependency properties, when PropertyChangedEventHandler does the job?

Currently I have use the following approach to setup change notification on any of my properties that I bind to in xaml: class MyClass : INotifyPropertyChanged { string name; public string Name { get { return name; } set { name = value; NotifyPropertyChanged("Name"); ...

WPF: How do I use two different controls in an ItemsControl?

I have a WPF ItemsControl who's ItemsSource is bound to an observable collection of view models in MVVM. The ItemTemplate is set to the user control that I want. However, there are instances when I would like another control instead of the one specified in XAML. How can I easily do this? ...

WPF: Error getting UserControl into ToolBox

I can remember that some time ago when I created a UserControl in Visual Studio 2008 the USerControls automatically appeared in the ToolBox. Now they don't. If use "Choose Items.." on the ToolBox I get the error message "The given assembly name or codebase was invalid", after selecting my assembly. I have Windows XP SP3 and .NET Framew...

Why does data binding break in OneWay mode ?

Here's a little XAML fragment. You will see <StackPanel> <TextBox x:Name="txtValue">250</TextBox> <Slider x:Name="slide" Value="{Binding ElementName=txtValue, Path=Text, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Minimum="0" Maximum="500"></Slider> </StackPanel> when you change the textbox valu...

Problem with SelectedItem of WPF Editable ComboBox with DataTemplate

I’m having the following issue with WPF Combo Box: XAML: <Window.Resources> <ResourceDictionary> <DataTemplate DataType="{x:Type this:Data}"> <ComboBox IsTextSearchEnabled="False" IsEditable="True" Text="{Binding Value}" ItemsSource="{Binding Menu}"/> </DataTemplate> </ResourceDictionary> </Window.R...

WPF: TextBox with ProgressBar

Is it possible in WPF to embed a ProgressBar in the Background of a TextBox? ...

Trace listener to write to a text box (WPF application)

For my WPF application I do logging to a text file using a TextWriterTraceListener. How can I also display the Trace output to a textbox? ...

WPF 3d — changing vertices in runtime (performance problem)

Inside a window I have Viewport3D which has ModelVisual3D with Model3DGroup inside. I configure 17 GeometryModel3D's. Meshes of all of them share the same Point3DCollection. The model is shown Ok. Then I change the Point3DCollection: private void btMutate_Click(object sender, RoutedEventArgs e) { Stopwatch sw = Stopwatch.StartNew...

Bind to Property in App.xaml.cs

Hi there, I have a Property in my App.xaml.cs called User that holds the User details. I have read here that you can't have a dependency property on the App class. I chose to use App.cs because it is global to the entire program and this is used for access control, but any alternatives are welcome. Now my question is how can I bind to...

How to handle Refresh and Reset in WPF application in MVP application

Hi, I am developing an windows UI application in WPF with MVP architecture with C#. The application will interact to sqlserver and displays the data to the user. I have 2 buttons REFRESH and RESET. which refreshes the page and resets the page to the home page respectively. As I searched in few forums,navigationservice is recommenede...

Accessing an element defined in a style's template in wpf?

I have a wpf tab control which I added a scrollviewer to. This is all wrapped into a style which is situated in a resource dictionary. Now, on the window's xaml side, all I do is set . I would like to access the control viewer element, as defined in the style as follows: <Style x:Key="MyTabStyle" TargetType="{x:Type TabControl}"> ...

Accessing an element defined in a style's template in wpf?

I have a wpf tab control which I added a scrollviewer to. This is all wrapped into a style which is situated in a resource dictionary. Now, on the window's xaml side, all I do is set . I would like to access the control viewer element, as defined in the style as follows: <Style x:Key="MyTabStyle" TargetType="{x:Type TabControl}">...

Mysterious WPF exception: 'PresentationFramework.Eren Vista'

All of the sudden I am getting this mysterious FileNotFoundException exception inside my WPF project. It occurs right in InitializeComponent of my Window constructor: Could not load file or assembly 'PresentationFramework.Eren Vista, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies...