wpf

Dispatcher.CurrentDispatcher?

If I do this... public PriorityQueue(Dispatcher dispatcher = null) { this.dispatcher = dispatcher ?? Dispatcher.CurrentDispatcher; } And then use it in a ViewModel (without passing any args) that is created through the XAML, this.dispatcher will point to the UI thread right? ...

How to encode into\decode from UTF-8 string in WPF ?

So I have a string like Русское Имя how to represent it as real string with wcf textBox? And How to encode for example russian string inputed into textInput into UTF-8? ...

Returning objects from another thread?

Trying to follow the hints laid out here, but she doesn't mention how to handle it when your collection needs to return a value, like so: private delegate TValue DequeueDelegate(); public virtual TValue Dequeue() { if (dispatcher.CheckAccess()) { --count; var pair = dict.First(); ...

TargetInvocationException?

Why would these lines of code cause that exception private Dispatcher dispatcher = null; public DownloadManager(Dispatcher dispatcher = null) { this.dispatcher = dispatcher ?? Dispatcher.CurrentDispatcher; } When the DownloadManager is instantiated in the XAML like <Window.DataContext> <c:DownloadManager ...

CMS (Web Application OR Windows Application)

I am a little bit puzzled about something. I am creating a ASP.NET MVC eCommerce application and currently I have written all the back end in ASP.NET MVC. I was thinking if its better to write all the management in WPF instead of HTML, as its probably even less prone to be exploited by hackers. I am a Windows user so I am not really bo...

WPF - DataTemplate to show only one hierarchical level in recursive data

Hi all, I am using a tree to display my data: persons grouped by their teams. In my model a team can contain another team, so the recursion. I want do display details about the selected node of the tree using a contentpresenter. If the selection is a person, everything is fine: I can show the person name or datails without problem using...

WPF Toolbar with no borders

I'm trying to style the toolbar to look like a Visual Studio panel toolbar, but I can't get rid of the round corners and overflow button. This is the code I currently have: <UserControl ...> <DockPanel> <ToolBar DockPanel.Dock="Top"> ... </ToolBar> </DockPanel> I've tried putting the toolbar inside a ToolBarTray ...

Opening FlowDocument saved as XPS document with XPS viewer?

I am saving a WPF FlowDocument to the file system, using this code and a fileName with an xps extension: // Save FlowDocument to file system as XPS document using (var fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { var textRange = new TextRange(m_Text.ContentStart, m_Text.ContentEnd); textRange.Sav...

Pin WPF window on the desktop in Windows 7

I want to pin a WPF window on the desktop (it should be a desktop gadget). I know you can do this by setting the parent handle of the WPF window to the handle of the "progman" window. But this does not prevent the hiding of the WPF window when "Windows + D" is pressed. There must be another way do to this. The new desktop gadgets in W...

Bind value between control in different view -- WPF / MVVM

Hello! in my MVVM application (in wpf) i have two view and I want to bind the context of my label on my textbox value (in the other view) SelectorView.xaml contain this control: <TextBox x:Name="tbArt" value="XX"/> DescriptionView.xaml contain this control: <label context="{binding on the tbArt value????}"> Is that possible directly ...

Design-time failure: WPF, Usercontrols and Namespaces

Hi I have a very simple WPF project comprising a Window and Usercontrol. I'm very much in a learning phase. It works fine when I run it. However, I am unable to see the form in design time. The problem, I believe is something to do with namespaces, but I don't understand where. It may well be a simple error Main Window XML <Window ...

WPF Manipulation and Touch events not firing, but mouse events do?

I have a Samsung LD220Z multi touch monitor, and when I'm experimenting with some WPF and touch features the touch events arent firing. The mouse down event seems to be firing however. Does this mean that I have to take into account that not all touch screen behave the same, and how do I get the touch inputs on my screen? I've tried the...

Routed Command Question

I'd like to implement a custom command to capture a Backspace key gesture inside of a textbox, but I don't know how. I wrote a test program in order to understand what's going on, but the behaviour of the program is rather confusing. Basically, I just need to be able to handle the Backspace key gesture via wpf commands while keyboard f...

How do I get the co-ordinates of a mouse click on a transformed WPF control?

I'm playing with a simple WPF application. One part of it includes a grid containing several controls. The grid is rotated using a LayoutTransform and a RotateTransform. I need to get the co-ordinates of a mouse-click relative to the top-left of the grid, taking the rotation into account. To be clear, let's say I have a single drawing s...

WPF: Create a dialog / prompt

Hello, I need to create a Dialog / Prompt including TextBox for user input. My problem is, how to get the text after having confirmed the dialog? Usually I would make a class for this which would save the text in a property. However I want do design the Dialog using XAML. So I would somehow have to extent the XAML Code to save the conte...

Scrolling list items in wpf

I guess the following picture depicts the problem better than texts... That is what I need. <ListBox x:Name="NamesListBox" ItemsSource="{Binding}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel x:Name="ItemWrapPanel"> <WrapPanel.RenderTransform> <TranslateTransform ...

Adding WPF Text Writer Trace Listener in an Outlook Add In using wpf window/control

I'm working on a outlook 2003 AddIn using VSTO SE.We have few customized windows developed in WPF. It looks there are few client machines have problem with WPF rendering due to which there could be an exception due to addin is getting disabled. I added a outlook.exe.config and added trace listeners for wpf Trace sources. I set it up acc...

Is there a way to put Setter elements inside EventTrigger?

Working on a WPF application, I started working on a custom ControlTemplate. I reached the point where I need to change some control properties when an event occurs. For this purpose, there are Setter elements. Seems all good, but I cannot use them inside EventTrigger elements. For example, if a simple Trigger, that can be bound to cont...

Scaled ellipse over button, button not clickable

Hi, I'm scaling an ellipse in an animation with the following code: ScaleTransform myScTransform = new ScaleTransform(); TransformGroup myTransGroup = new TransformGroup(); myTransGroup.Children.Add(myScTransform); newPHRadio.RenderTransform = myTransGroup; newPHRadio.RenderTransformOrigin = new ...

Is MVVM pointless?

Is orthodox MVVM implementation pointless? I am creating a new application and I considered Windows Forms and WPF. I chose WPF because it's future-proof and offer lots of flexibility. There is less code and easier to make significant changes to your UI using XAML. Since the choice for WPF is obvious, I figured that I may as well go...