Conditional assembly name in xmlns

In a xaml file, the namespace is as follows: xmlns:vsp="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0" Trouble is, for Visual Studio 2015 it will be (notice the different assembly) xmlns:vsp="clr-names...
more »

2017-12-02 17:12 (1) Answers

Extending ref keyword to another variable

I'm developing wpf application. I'm trying to pass object by reference using ref keyword and then pass it to another variable in constructor to change it later. But when I change the variable to which I passed the reference in constructor varaible ...
more »

2017-12-02 15:12 (1) Answers

Change windows style on click WPF

I want to change style on click, but simply cant find any way to do it. Here is styles <Style x:Key="CustomWindowStyle" TargetType="{x:Type Window}"> <Setter Property="WindowStyle" Value="None"/> <Setter Property="All...
more »

2017-12-02 10:12 (1) Answers

How to change the font size in a mahapps project?

So I am trying to change the default font family and the font size in my project. I decided to start with buttons. I do it like this (I am gonna create a separated file for my style, but now I just want to make it work somehow): <Controls:MetroW...
more »

2017-12-01 15:12 (2) Answers

WPF visual refresh

I have a UserControl OGLUC that computes visualisation stuff via a RefreshVisual() function. (In details it integrates a WinForms C++/CLI class that display an OpenGL window but I don't think that is important). Visual updates are made at about 10Hz...
more »

2017-12-01 09:12 (0) Answers

How secure is the WPF PasswordBox, really?

I've already asked a couple of questions around the PasswordBox recently, but at the heart of my issue, I need an extremely secure way of getting very sensitive information inputted into my .Net application. Out of the box, the WPF PasswordBox is th...
more »

2017-11-30 16:11 (2) Answers

C# Error with Read Only assignment

I have a WPF C# project that I am moving to Visual Studio 2013. The following code had compiled OK, but now it is failing: CultureInfo origCulture = CultureInfo.CurrentUICulture; CultureInfo.CurrentCulture = new CultureInfo(DILData.GetString("Confi...
more »

2017-11-30 01:11 (1) Answers

Make WPF-control shared

I'm trying to access Label from another class's method running in background thread with the help of MainWindow Class's Public Shared Sub like this: Private Delegate Sub ProgressReportInvoker(ByVal progressStr As String) Public Shared Sub P...
more »

2017-11-29 11:11 (2) Answers

WPF locking workstation programmatically

I am trying to automate workstation locking after the occurence of a WPF event. The solution is supposed to work for both x64 and x86 architectures. I've tried the method LockWorkStation() accessible through user32.dll but it works only on x86 arch...
more »

2017-11-29 09:11 (1) Answers

Get connectionString for current DB

I'm trying to find out connectionString which would be like: TestDB.Properties.Settings.TestDBConnectionString (according to this video), but I'm working with WPF and there is no <connectionStrings> in App.config. I looked at properties of m...
more »

2017-11-28 22:11 (1) Answers

How to detect when the visual tree is destroyed?

In a WPF application I have, I have a control that is central to the application. This control, called ArtView, is visible for the entire lifetime of the main window. It performs hardware accelerated rendering, and in order to avoid bogging down the ...
more »

2017-11-28 15:11 (1) Answers

WPF binding with Datacontext

I'm new to WPF programming and I have this question going through my mind. Why does binding only work when using properties instead of fields? Here's the example that gave me this question: xaml: <ListBox ItemsSource="{Binding requiredPermissi...
more »

2017-11-28 11:11 (2) Answers