Last Updated: 27 Jan 2014 15:38 by ADMIN
Larry Salveson
Created on: 17 Jan 2014 21:38
Category: Window
Type: Feature Request
radwindow dialog size
The default dialogs for the WPF RadWindow (Prompt, Alert, Confirm) do not seem to allow sizing of the content of the message. I have tried imbedding controls to set width and maxwidth, but I need to use a MaxWidth to prevent horizontal scrollbars. Ideally a Maxwidth parameter would be available allowing longer text message to spread out.

The code below works, but I'm restricted to a narrow dialog.

            Dim Scroller As New ScrollViewer
            Dim TextBlk As New Controls.TextBlock()
            With Scroller
                .HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
                .VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                If Owner IsNot Nothing Then
                    .MaxHeight = (WPFScreen.GetScreenFromElement(Owner).WorkingArea.Height - 100) 'Do not use entire height
                    .MaxHeight = (WPFScreen.Primary.WorkingArea.Height - 300) 'Do not use entire height
                End If

                With TextBlk
                    .Margin = New Thickness(10)
                    .TextWrapping = TextWrapping.Wrap
                    .Text = Message
                    'We seem to be stuck with a fixed width available for our text.
                    'If this is increased a horizontal scrollbar appears.
                    .MaxWidth = 230
                End With
                .Content = TextBlk                  'Put textblock in scroller                 
            End With

            Dim RadDialog As New DialogParameters
            With RadDialog
                .Content = Scroller
                .DefaultPromptResultValue = DefaultValue        'Default prompt result
                .DialogStartupLocation = DialogStartupLocation
                .Header = Header
                .IconContent = IconContent
                If ThemeName.ToLower <> "expression_dark" Then ' *NoLoc*
                    .ModalBackground = m_SPIBackgroundBrush
                End If
                .Owner = Owner
                .Closed = New EventHandler(Of WindowClosedEventArgs)(AddressOf OnPromptClosed)  'Reference handler for response
            End With

(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
Posted on: 27 Jan 2014 15:38
Hi Larry,

Thanks for your feedback.

The desired functionality can be easily implemented by modifying the default ControlTemplate of the Prompt/Alert/Confirm in order to include a TextBlock with TextWrapping set to Wrap.