I am using Brads Dialog Presenter.
It works great, but i only have 1 problem...
I can't get it so that the dialog shows Center Screen.
Can anyone help me here please.
I am using Brads Dialog Presenter.
It works great, but i only have 1 problem...
I can't get it so that the dialog shows Center Screen.
Can anyone help me here please.
This converter worked for me.
In DialogPresenter.Generic.xaml
<controls:DragCanvas Name="DialogCanvas">
<Grid x:Name="Dialog" ...>
<Canvas.Top>
<MultiBinding Converter="{StaticResource CenterConverter}" ConverterParameter="top">
<Binding ElementName="DialogCanvas" Path="ActualWidth" />
<Binding ElementName="DialogCanvas" Path="ActualHeight" />
<Binding ElementName="Dialog" Path="ActualWidth" />
<Binding ElementName="Dialog" Path="ActualHeight" />
</MultiBinding>
</Canvas.Top>
<Canvas.Left>
...
</Canvas.Left>
There are a couple of ways you can get the dialog centered.
In the DialogPresenter class, update the Show() method to set the window.WindowStartupPosition = WindowStartupLocation.CenterScreen.
Write a custom TriggerAction and override Invoke to do the following.
var window = Window.GetWindow(this.AssociatedObject); window.WindowStartupLocation.CenterScreen
then attach the trigger action to the ControlTemplate in the triggers section. You would use an EventTrigger using the LoadedEvent and calling your TriggerAction.
Note: If you have ExpressionBlend, it makes dragging TriggerActions to the UI easy because it writes the EventTrigger part for you.