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

WPF

 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 7:02
mvePete O'Hanlon14-Mar-12 7:02 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey14-Mar-12 10:12
Sutton Mehaffey14-Mar-12 10:12 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 10:25
mvePete O'Hanlon14-Mar-12 10:25 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey14-Mar-12 10:44
Sutton Mehaffey14-Mar-12 10:44 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 10:50
mvePete O'Hanlon14-Mar-12 10:50 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey21-Mar-12 18:52
Sutton Mehaffey21-Mar-12 18:52 
QuestionFlip page animation.Again. Pin
demolexpert13-Mar-12 7:40
demolexpert13-Mar-12 7:40 
Questionunable to access parent property from a Trigger Pin
George Nistor13-Mar-12 7:15
George Nistor13-Mar-12 7:15 
Hi I needed a custom ComboBox control with a DataGrid as popup. I managed to change the MSDN example and everything works except I can't set ComboBox.IsDropDownOpen property from the
Trigger.
It it usefull also for setting ComboBox.Text property with the text selected from the DataGrid.

The problem is at the end near comments:
Property="ComboBox.IsDropDownOpen" Value="False"
(this line does not have any affect because the comboBox is not identified by name or style type).

Somehow I need to specify the comboBox style..

Any ideas how to do it?

RelativeSource with TemplateParent..

<pre lang="HTML">
<Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ComboBox">
                        <Grid>
                            <ToggleButton 
            Name="ToggleButton" 
            Template="{StaticResource ComboBoxToggleButton}" 
            Grid.Column="2" 
            Focusable="false"
            IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
            ClickMode="Press">
                            </ToggleButton>
                            <ContentPresenter
            Name="ContentSite"
            IsHitTestVisible="False" 
            Content="{TemplateBinding SelectionBoxItem}"
            ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
            ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
            Margin="3,3,23,3"
            VerticalAlignment="Center"
            HorizontalAlignment="Left" />
                            <TextBox x:Name="PART_EditableTextBox"
            Style="{x:Null}" 
            Template="{StaticResource ComboBoxTextBox}" 
            HorizontalAlignment="Left" 
            VerticalAlignment="Center" 
            Margin="3,3,23,3"
            Focusable="True" 
            Background="Transparent"
            Visibility="Hidden"
            IsReadOnly="{TemplateBinding IsReadOnly}"/>
            <Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
               <Grid   Name="DropDown"  SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}"  MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                    <Border 
                x:Name="DropDownBorder"
                Background="{StaticResource WindowBackgroundBrush}"
                BorderThickness="1"
                BorderBrush="{StaticResource SolidBorderBrush}"/>
              
                                    <DataGrid
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                            ItemsSource="{TemplateBinding ItemsSource}"
                                            AutoGenerateColumns="False"
                                            IsReadOnly="True"
                                        GridLinesVisibility="None"
                                        Background="LightGray" 
                                        RowBackground="LightBlue"
                                        AlternatingRowBackground="LightCyan"
                                        SelectedItem="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Path=SelectedIndex}">
                                        <DataGrid.Columns>
                                            <DataGridTextColumn
                                                    Header="Name"
                                                    MinWidth="150"    
                                                    Binding="{Binding Path=Name}"/>
                                            <DataGridTextColumn
                                                    Header="Address"
                                                    MinWidth="200"   
                                                    Binding="{Binding Path=Address}"/>
                                        </DataGrid.Columns>

                                        <DataGrid.CellStyle>
                                            <Style TargetType="DataGridCell">
                                                <Style.Triggers>
                                                    <Trigger Property="IsSelected"  Value="True">
                                                        <!-- try to access directly parrent property-->
                                                        
                                                        <Setter Property="ComboBox.IsDropDownOpen" Value="False"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>

QuestionBinding Fill property to value of node with particular id in XML Pin
Mahesha99912-Mar-12 21:32
Mahesha99912-Mar-12 21:32 
Questioninteraction between Models in PRISM V4 (WPF) Pin
radhwane12-Mar-12 13:09
radhwane12-Mar-12 13:09 
Questiondefining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 3:37
Sutton Mehaffey12-Mar-12 3:37 
AnswerRe: defining a grid row within a grid column, wpf, c# Pin
Pete O'Hanlon12-Mar-12 3:42
mvePete O'Hanlon12-Mar-12 3:42 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 4:50
Sutton Mehaffey12-Mar-12 4:50 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 4:51
Sutton Mehaffey12-Mar-12 4:51 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 4:52
Sutton Mehaffey12-Mar-12 4:52 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Pete O'Hanlon12-Mar-12 4:59
mvePete O'Hanlon12-Mar-12 4:59 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 5:15
Sutton Mehaffey12-Mar-12 5:15 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Pete O'Hanlon12-Mar-12 5:22
mvePete O'Hanlon12-Mar-12 5:22 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 5:32
Sutton Mehaffey12-Mar-12 5:32 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey12-Mar-12 15:33
Sutton Mehaffey12-Mar-12 15:33 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Pete O'Hanlon12-Mar-12 22:32
mvePete O'Hanlon12-Mar-12 22:32 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Sutton Mehaffey13-Mar-12 2:52
Sutton Mehaffey13-Mar-12 2:52 
GeneralRe: defining a grid row within a grid column, wpf, c# Pin
Pete O'Hanlon13-Mar-12 3:11
mvePete O'Hanlon13-Mar-12 3:11 
QuestionSliver light Pin
mehul_porject11-Mar-12 19:32
mehul_porject11-Mar-12 19:32 
AnswerRe: Sliver light Pin
Abhinav S11-Mar-12 19:56
Abhinav S11-Mar-12 19:56 

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.