Click here to Skip to main content
14,638,468 members
Home » Discussions » Silverlight / WPF
   

Silverlight / WPF

 
GeneralRe: WPF ListCollectionView CustomSort - how to turn off live sorting Pin
Jonas Thor31-Jan-18 4:00
MemberJonas Thor31-Jan-18 4:00 
GeneralRe: WPF ListCollectionView CustomSort - how to turn off live sorting Pin
Gerry Schmitz31-Jan-18 6:03
mveGerry Schmitz31-Jan-18 6:03 
QuestionDeploy desktop app with Target .net framwork 4 using Visual stuidio 2017 Pin
mhemant23-Jan-18 22:56
Membermhemant23-Jan-18 22:56 
QuestionStrange RadioButton Binding Problem Pin
Kevin Marois20-Jan-18 9:55
professionalKevin Marois20-Jan-18 9:55 
AnswerRe: Strange RadioButton Binding Problem Pin
Richard Deeming22-Jan-18 8:16
mveRichard Deeming22-Jan-18 8:16 
QuestionWPF Desktop client on Win XP Pin
mhemant18-Jan-18 1:20
Membermhemant18-Jan-18 1:20 
AnswerRe: WPF Desktop client on Win XP Pin
Jochen Arndt18-Jan-18 3:08
professionalJochen Arndt18-Jan-18 3:08 
QuestionWPF ComboBox Separator Style Problem Pin
Kevin Marois15-Jan-18 9:50
professionalKevin Marois15-Jan-18 9:50 
I have a style that use in some combo boxes to display a separator:
<ComboBox ItemsSource="{Binding Items}"<br />
            SelectedItem="{Binding SelectedItem}"
            DisplayMemberPath="Caption"
            SelectedValuePath="{Binding SelectedItemId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

<pre>
<ComboBox.ItemContainerStyle>
    <Style TargetType="{x:Type ComboBoxItem}" 
            BasedOn="{StaticResource {x:Type ComboBoxItem}}">

        <Style.Triggers>
            <DataTrigger Binding="{Binding Caption}" Value="">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                            <Separator HorizontalAlignment="Stretch" IsEnabled="False"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>

    </Style>
</ComboBox.ItemContainerStyle>



This works perfectly when I don't have a data template. In this next example I want a checked list so I have checkboxes as well as captions in a DataTemplate:
<ComboBox Grid.Row="0"
            Grid.Column="3"
            FontSize="14"
            HorizontalAlignment="Left"
            VerticalAlignment="Center"
            MinWidth="250"
            ItemsSource="{Binding Company.CompanyTypes}"
            SelectedValuePath="{Binding SelectedCompanyTypeId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
            IsEnabled="{Binding AreFieldsEnabled}"
            Margin="3">

<pre>
<ComboBox.ItemContainerStyle>
    <Style TargetType="{x:Type ComboBoxItem}"
            BasedOn="{StaticResource {x:Type ComboBoxItem}}">

        <Style.Triggers>
            <DataTrigger Binding="{Binding Caption}" Value="">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                            <Separator HorizontalAlignment="Stretch"
                                        IsEnabled="False"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>

    </Style>
</ComboBox.ItemContainerStyle>

<ComboBox.ItemTemplate>
    <DataTemplate>
        <StackPanel Orientation="Horizontal">
            <CheckBox IsChecked="{Binding IsSelected}"
                        Margin="2"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"/>
            <TextBlock Text="{Binding Caption}"
                        Margin="2"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"/>
        </StackPanel>
    </DataTemplate>
</ComboBox.ItemTemplate>




In this case the separator line doesn't appear, the bar itself is clickable, and the checkbox is showing.

How can I apply a stlye to solve these 3 problems?

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

QuestionDividing a TextBox into columns Pin
Dwayne Barsotta6-Jan-18 16:47
MemberDwayne Barsotta6-Jan-18 16:47 
AnswerRe: Dividing a TextBox into columns Pin
Mycroft Holmes6-Jan-18 21:14
professionalMycroft Holmes6-Jan-18 21:14 
GeneralRe: Dividing a TextBox into columns Pin
Dwayne Barsotta7-Jan-18 3:27
MemberDwayne Barsotta7-Jan-18 3:27 
GeneralRe: Dividing a TextBox into columns Pin
Mycroft Holmes7-Jan-18 10:21
professionalMycroft Holmes7-Jan-18 10:21 
GeneralRe: Dividing a TextBox into columns Pin
Dwayne Barsotta27-Jan-18 6:24
MemberDwayne Barsotta27-Jan-18 6:24 
AnswerRe: Dividing a TextBox into columns Pin
Gerry Schmitz7-Jan-18 7:26
mveGerry Schmitz7-Jan-18 7:26 
AnswerRe: Dividing a TextBox into columns Pin
Kenneth Haugland7-Jan-18 17:41
professionalKenneth Haugland7-Jan-18 17:41 
AnswerRe: Dividing a TextBox into columns Pin
Dwayne Barsotta27-Jan-18 6:39
MemberDwayne Barsotta27-Jan-18 6:39 
GeneralRe: Dividing a TextBox into columns Pin
Gerry Schmitz27-Jan-18 12:47
mveGerry Schmitz27-Jan-18 12:47 
QuestionProblems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 0:52
professionalKenneth Haugland6-Jan-18 0:52 
AnswerRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 7:48
mveGerry Schmitz6-Jan-18 7:48 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 8:09
professionalKenneth Haugland6-Jan-18 8:09 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 8:26
mveGerry Schmitz6-Jan-18 8:26 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 8:41
professionalKenneth Haugland6-Jan-18 8:41 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 8:51
mveGerry Schmitz6-Jan-18 8:51 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Kenneth Haugland6-Jan-18 9:17
professionalKenneth Haugland6-Jan-18 9:17 
GeneralRe: Problems pausing and restarting animations in XAML Pin
Gerry Schmitz6-Jan-18 9:32
mveGerry Schmitz6-Jan-18 9:32 

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.