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

WPF

 
GeneralRe: NavigationControl - Continued Pin
Richard Deeming3-May-23 21:35
mveRichard Deeming3-May-23 21:35 
QuestionWPF 3D rendering Pin
Kenneth Haugland1-May-23 4:52
mvaKenneth Haugland1-May-23 4:52 
AnswerRe: WPF 3D rendering Pin
Gerry Schmitz2-May-23 6:14
mveGerry Schmitz2-May-23 6:14 
GeneralRe: WPF 3D rendering Pin
Kenneth Haugland2-May-23 9:59
mvaKenneth Haugland2-May-23 9:59 
AnswerRe: WPF 3D rendering Pin
RedDk2-May-23 8:03
RedDk2-May-23 8:03 
GeneralRe: WPF 3D rendering Pin
Kenneth Haugland2-May-23 10:01
mvaKenneth Haugland2-May-23 10:01 
QuestionExpander in ListBoxItem Width Problem Pin
Kevin Marois27-Apr-23 7:19
professionalKevin Marois27-Apr-23 7:19 
AnswerRe: Expander in ListBoxItem Width Problem Pin
Richard Deeming1-May-23 23:09
mveRichard Deeming1-May-23 23:09 
Remove the Width binding and the HorizontalAlignment on the ctrls:NavigationPane element. Instead, set the HorizontalContentAlignment property on the ListBox.
XAML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
                    xmlns:ctrls="clr-namespace:NavigationContainer">

    <!--NAVIGATION PANE-->
    <Style TargetType="{x:Type ctrls:NavigationPane}">

        <Setter Property="MaxHeight" Value="300"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctrls:NavigationPane}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Expander Header="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}"
                                  Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}"
                                  Margin="{Binding Margin, RelativeSource={RelativeSource TemplatedParent}}"
                                  BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"
                                  BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}"
                                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                                  IsExpanded="True">

                            <Grid>
                                <ListBox ItemsSource="{Binding Items, RelativeSource={RelativeSource TemplatedParent}}"
                                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                         Margin="2"
                                         BorderBrush="Transparent"
                                         BorderThickness="0">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>

                                            <TextBlock Text="{Binding Caption}"
                                                       Margin="2"/>

                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </Grid>
                        </Expander>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ctrls:NavigationContainer}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ctrls:NavigationContainer}">
                    <Border Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}"
                            Margin="{Binding Margin, RelativeSource={RelativeSource TemplatedParent}}"
                            Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
                            BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"
                            BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}">

                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <!--CONTAINER PANES-->
                            <ListBox Grid.Row="1"
                                     Margin="1"
                                     BorderThickness="1"
                                     HorizontalContentAlignment="Stretch"
                                     ItemsSource="{Binding ContainerItems, RelativeSource={RelativeSource TemplatedParent}}"
                                     ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                     ScrollViewer.VerticalScrollBarVisibility="Auto">

                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <ctrls:NavigationPane 
                                                              BorderBrush="Orange" 
                                                              BorderThickness="3"
                                                              Background="Red"
                                                              Header="{Binding Header}"
                                                              Items="{Binding Items}"
                                                              Margin="0,0,0,1"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
xaml - How to get a ListBox ItemTemplate to stretch horizontally the full width of the ListBox? - Stack Overflow[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Expander in ListBoxItem Width Problem Pin
Kevin Marois2-May-23 7:12
professionalKevin Marois2-May-23 7:12 
QuestionSpinning Indicator Control Error Pin
Kevin Marois26-Apr-23 14:32
professionalKevin Marois26-Apr-23 14:32 
AnswerRe: Spinning Indicator Control Error Pin
Gerry Schmitz27-Apr-23 7:01
mveGerry Schmitz27-Apr-23 7:01 
GeneralRe: Spinning Indicator Control Error Pin
Kevin Marois27-Apr-23 7:27
professionalKevin Marois27-Apr-23 7:27 
GeneralRe: Spinning Indicator Control Error Pin
Gerry Schmitz28-Apr-23 4:46
mveGerry Schmitz28-Apr-23 4:46 
GeneralRe: Spinning Indicator Control Error Pin
Kevin Marois28-Apr-23 7:24
professionalKevin Marois28-Apr-23 7:24 
QuestionFlat Button Style Problem Pin
Kevin Marois22-Apr-23 18:14
professionalKevin Marois22-Apr-23 18:14 
AnswerRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 8:55
mveGerry Schmitz23-Apr-23 8:55 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois23-Apr-23 9:15
professionalKevin Marois23-Apr-23 9:15 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 15:28
mveGerry Schmitz23-Apr-23 15:28 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois25-Apr-23 19:08
professionalKevin Marois25-Apr-23 19:08 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz26-Apr-23 5:20
mveGerry Schmitz26-Apr-23 5:20 
QuestionReport Designer Suggestions Pin
Kevin Marois13-Apr-23 13:37
professionalKevin Marois13-Apr-23 13:37 
AnswerRe: Report Designer Suggestions Pin
Pete O'Hanlon13-Apr-23 21:23
mvePete O'Hanlon13-Apr-23 21:23 
AnswerRe: Report Designer Suggestions Pin
Gerry Schmitz14-Apr-23 3:51
mveGerry Schmitz14-Apr-23 3:51 
QuestionCustom Navigation Control Pin
Kevin Marois12-Apr-23 16:23
professionalKevin Marois12-Apr-23 16:23 
AnswerRe: Custom Navigation Control Pin
Pete O'Hanlon13-Apr-23 21:36
mvePete O'Hanlon13-Apr-23 21:36 

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.