Click here to Skip to main content
15,388,904 members
Home / Discussions / WPF
   

WPF

 
QuestionStuck with Weird Exceptions Pin
Kevin Marois7-Sep-21 13:51
professionalKevin Marois7-Sep-21 13:51 
AnswerRe: Stuck with Weird Exceptions Pin
Richard Deeming7-Sep-21 21:28
mveRichard Deeming7-Sep-21 21:28 
GeneralRe: Stuck with Weird Exceptions Pin
Kevin Marois8-Sep-21 4:58
professionalKevin Marois8-Sep-21 4:58 
QuestionDisable ComboBox Hyperlinks Pin
Kevin Marois19-Aug-21 12:43
professionalKevin Marois19-Aug-21 12:43 
AnswerRe: Disable ComboBox Hyperlinks Pin
Richard Deeming19-Aug-21 21:35
mveRichard Deeming19-Aug-21 21:35 
GeneralRe: Disable ComboBox Hyperlinks Pin
Kevin Marois20-Aug-21 4:36
professionalKevin Marois20-Aug-21 4:36 
AnswerRe: Disable ComboBox Hyperlinks Pin
Matt T Heffron25-Aug-21 11:08
professionalMatt T Heffron25-Aug-21 11:08 
QuestionWPF DataGrid - Stretch Row Details Vertically Pin
Kevin Marois29-Jul-21 7:39
professionalKevin Marois29-Jul-21 7:39 
I've got Row Details section in a DataGrid. The DataGrid's width is set to 1500, yet the row details content stretches off the right side of the grid. Here's all the XAML.

Here's a screen shot

How do I make the Row Details content wrap?
<DataGrid x:Name="seqSheetDataGrid"
          Grid.Row="1"
          Grid.Column="0"
          ItemsSource="{Binding SequenceSheets, Mode=TwoWay}"
          SelectedItem="{Binding SelectedSequenceSheet, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
          RowDetailsVisibilityMode="Visible"
          behaviors:SortDescriptionBehavior.Property="SeqSheetGridSortDescription"
          MaxWidth="1700">

    <DataGrid.Resources>
        <Style TargetType="DataGridCell" BasedOn="{StaticResource dataGridCellStyle}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Status}" Value="Removed">
                    <Setter Property="FontStyle" Value="Italic" />
                    <Setter Property="Foreground" Value="LightGray" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </DataGrid.Resources>

    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow"
               BasedOn="{StaticResource dataGridRowStyle}">
            <Setter Property="BorderBrush" Value="SteelBlue" />
            <Setter Property="BorderThickness" Value="0,0,0,1" />
            <Setter Property="Height" Value="{x:Static sys:Double.NaN}"/>
        </Style>
    </DataGrid.RowStyle>

    <DataGrid.Style>
        <Style TargetType="DataGrid"
               BasedOn="{StaticResource dataGridStyle}">

            <Setter Property="IsReadOnly" Value="True" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding AreFieldsEnabled}" Value="True" />
                        <Condition Binding="{Binding Job.ContractDate, Converter={StaticResource IsNotNullConverter}}" Value="True" />
                        <Condition Binding="{Binding Job.ContractDateInitials, Converter={StaticResource IsNotNullConverter}}" Value="True" />
                    </MultiDataTrigger.Conditions>

                    <MultiDataTrigger.Setters>
                        <Setter Property="IsReadOnly" Value="False" />
                    </MultiDataTrigger.Setters>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>
    </DataGrid.Style>

    <DataGrid.Columns>

        <DataGridTextColumn Header="Sequence"
                            Binding="{Binding Sequence, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="120"
                            SortDirection="Ascending"
                            SortMemberPath="Sequence"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Lot's / Bldgs"
                            Binding="{Binding Lot, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="120"
                            SortMemberPath="Lot"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Plan"
                            Binding="{Binding Plan, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="120"
                            SortMemberPath="Plan"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Square Feet"
                            Binding="{Binding SquareFeet, StringFormat={}{0:#,#}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="120"
                            HeaderStyle="{StaticResource dataGridRightAlignColHeaderStyle}"
                            SortMemberPath="SquareFeet"
                            IsReadOnly="True">

            <DataGridTextColumn.ElementStyle>
                <Style>
                    <Setter Property="TextBlock.TextAlignment" Value="Right" />
                </Style>
            </DataGridTextColumn.ElementStyle>

        </DataGridTextColumn>

        <DataGridTextColumn Header="Elevation"
                            Binding="{Binding Elevation, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="120"
                            SortMemberPath="Elevation"
                            IsReadOnly="True"/>

        <DataGridComboBoxColumn Header="Garage Type"
                                SelectedValueBinding="{Binding GarageTypeId}"
                                SelectedValuePath="Id"
                                DisplayMemberPath="Caption"
                                Width="120"
                                SortMemberPath="GarageTypeId"
                                IsReadOnly="True">

            <DataGridComboBoxColumn.ElementStyle>
                <Style TargetType="{x:Type ComboBox}">
                    <Setter Property="ItemsSource" Value="{Binding ElementName=jobView, Path=DataContext.GarageTypes}" />
                </Style>
            </DataGridComboBoxColumn.ElementStyle>
            <DataGridComboBoxColumn.EditingElementStyle>
                <Style TargetType="{x:Type ComboBox}">
                    <Setter Property="ItemsSource" Value="{Binding ElementName=jobView, Path=DataContext.GarageTypes}" />
                </Style>
            </DataGridComboBoxColumn.EditingElementStyle>

        </DataGridComboBoxColumn>

        <DataGridTextColumn Header="Enhanced Rear"
                            Binding="{Binding EnhancedRear, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource TrueFalseYesNoConverter}}"
                            Width="120"
                            SortMemberPath="EnhancedRear"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Enhanced Left"
                            Binding="{Binding EnhancedLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource TrueFalseYesNoConverter}}"
                            Width="120"
                            SortMemberPath="EnhancedLeft"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Enhanced Right"
                            Binding="{Binding EnhancedRight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource TrueFalseYesNoConverter}}"
                            Width="120"
                            SortMemberPath="EnhancedRight"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Address"
                            Binding="{Binding Address, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="400"
                            SortMemberPath="Address"
                            IsReadOnly="True"/>

        <DataGridTextColumn Header="Status"
                            Binding="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            Width="150"
                            SortMemberPath="Status"
                            IsReadOnly="True"/>

    </DataGrid.Columns>

    <DataGrid.RowDetailsTemplate>
        <DataTemplate>

            <StackPanel Orientation="Horizontal">

                <TextBlock Text="Options: "
                           FontWeight="Bold"
                           Margin="2" />

                <TextBlock Text="{Binding OptionsText}"
                           TextWrapping="Wrap"
                           Margin="2" >
                    <TextBlock.Style>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Status}" Value="Removed">
                                    <Setter Property="FontStyle" Value="Italic" />
                                    <Setter Property="Foreground" Value="LightGray" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>

            </StackPanel>

        </DataTemplate>

    </DataGrid.RowDetailsTemplate>

</DataGrid>
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 29-Jul-21 13:48pm.

QuestionGet MainWindow from Executing Assembly Pin
Kevin Marois23-Jul-21 8:59
professionalKevin Marois23-Jul-21 8:59 
AnswerRe: Get MainWindow from Executing Assembly Pin
Richard Deeming27-Jul-21 23:18
mveRichard Deeming27-Jul-21 23:18 
GeneralRe: Get MainWindow from Executing Assembly Pin
Kevin Marois28-Jul-21 10:04
professionalKevin Marois28-Jul-21 10:04 
GeneralCan anyone recommend a free WPF editor control? Pin
Mike Hankey23-Jul-21 4:25
professionalMike Hankey23-Jul-21 4:25 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Slacker00723-Jul-21 4:39
professionalSlacker00723-Jul-21 4:39 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Richard Andrew x6423-Jul-21 4:45
professionalRichard Andrew x6423-Jul-21 4:45 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Mike Hankey23-Jul-21 4:50
professionalMike Hankey23-Jul-21 4:50 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Slacker00723-Jul-21 5:01
professionalSlacker00723-Jul-21 5:01 
GeneralRe: Can anyone recommend a free WPF editor control? Pin
Richard Deeming27-Jul-21 23:16
mveRichard Deeming27-Jul-21 23:16 
GeneralRe: Can anyone recommend a free WPF editor control? Pin
Mike Hankey28-Jul-21 2:05
professionalMike Hankey28-Jul-21 2:05 
QuestionInstalling Test Mode vs Production Mode Pin
Kevin Marois19-Jul-21 8:55
professionalKevin Marois19-Jul-21 8:55 
QuestionRouted Event Args Null Pin
Kevin Marois28-Jun-21 16:28
professionalKevin Marois28-Jun-21 16:28 
AnswerRe: Routed Event Args Null Pin
Richard Deeming28-Jun-21 22:34
mveRichard Deeming28-Jun-21 22:34 
QuestionHow to change background color in combobox in code behind? Pin
Cường Nguyễn Văn 202123-Jun-21 6:56
MemberCường Nguyễn Văn 202123-Jun-21 6:56 
QuestionMake textbox fill up and resizie Pin
Acuena21-Jun-21 20:59
MemberAcuena21-Jun-21 20:59 
AnswerRe: Make textbox fill up and resizie Pin
Richard Deeming21-Jun-21 21:58
mveRichard Deeming21-Jun-21 21:58 
AnswerRe: Make textbox fill up and resizie Pin
Gerry Schmitz22-Jun-21 7:07
mveGerry Schmitz22-Jun-21 7:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.