Window Title/DisplayName

Nov 22, 2010 at 4:35 PM

I am using the WindowManager to open a new DialogWindow. It is a Window type (not a Usercontrol) that I am opening. It is a custom styled window. So I am trying to manually render the Title in the title bar.

I did this in my ShellView by binding like this:

<TextBlock Text="{Binding Title, RelativeSource={RelativeSource FindAncestor,AncestorType=Window}}"

This did not work in my new Window created with:


It looks like the WindowManager will setup the binding of DisplayName and Title for me, so I am creating my new VM like this:

public class NewWindowVM : Screen, IHaveDisplayName

and then Binding my TextBlock to DisplayName. But this doesn't work either. Instead it is just rendering the entire namespace/classname of my Window.

I can easily just manually set the text to whatever I want, but it'd be nice to bind to the Title property or DisplayName (which binds to Title).

Where am I going wrong?

Nov 22, 2010 at 4:47 PM

Screen already implements IHaveDisplayName, so no need to re-implement it. Just set the DisplayName property in your VMs constructor to what you want to see (that property is set to the type name by default in Screen). That should do it.

Mar 24, 2011 at 5:04 PM

How would I set the default icon of all windows. I have attempted to implement a style in App.xaml but this does not seem to have any effect.


<Style TargetType="{x:Type Window}">                        <Setter Property="Window.Icon" Value="test.png"/>                    </Style>

Thank you

Jan 16, 2015 at 7:23 PM
Edited Jan 16, 2015 at 7:23 PM
I am inheriting from Conductor and setting the DisplayName in the ctor, but resharper is giving the warning 'Virtual member call in constructor'. Other than sealing the class, is there a better way to set this?