Click here to Skip to main content
15,895,283 members
Home / Discussions / WPF
   

WPF

 
Questionn00b - pointer please Pin
Dalek Dave7-Sep-10 9:15
professionalDalek Dave7-Sep-10 9:15 
AnswerRe: n00b - pointer please Pin
Pete O'Hanlon7-Sep-10 9:22
mvePete O'Hanlon7-Sep-10 9:22 
GeneralRe: n00b - pointer please Pin
Dalek Dave7-Sep-10 10:44
professionalDalek Dave7-Sep-10 10:44 
GeneralRe: n00b - pointer please Pin
Pete O'Hanlon7-Sep-10 11:09
mvePete O'Hanlon7-Sep-10 11:09 
GeneralRe: n00b - pointer please Pin
Dalek Dave7-Sep-10 11:20
professionalDalek Dave7-Sep-10 11:20 
GeneralRe: n00b - pointer please Pin
Pete O'Hanlon7-Sep-10 11:30
mvePete O'Hanlon7-Sep-10 11:30 
AnswerRe: n00b - pointer please Pin
Abhinav S8-Sep-10 6:23
Abhinav S8-Sep-10 6:23 
QuestionCombo box inside a user control disappears when style is applied Pin
dashingsidds7-Sep-10 1:40
dashingsidds7-Sep-10 1:40 
Hi,

I am trying to apply a style to a combo box but instead of getting applied the combo box itself disappears. Please check the following xaml code for user control.

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" 
    x:Class="Guardian.PAS.PASFramework.UI.WPF.PASComboBox"
    xmlns:local="clr-namespace:Guardian.PAS.PASFramework.UI.WPF"
    Height="26" Width="100" VerticalAlignment="Center" >
    <UserControl.Resources>
        <Style x:Key="comboBoxStyle" TargetType="{x:Type local:PASCustomComboBox}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:PASCustomComboBox}">
                        <ControlTemplate.Triggers>
                            <Trigger Property="local:PASCustomComboBox.IsEnabled" Value="false">
                                <Setter Property="Background" Value="Red"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Canvas Name="canvas" Height="23" Width="Auto" VerticalAlignment="Center">
        <Label Height="23" Name="lblCaption" Width="20" VerticalAlignment="Center">aaa</Label>
        <local:PASCustomComboBox Height="23" x:Name="cmbComboBoxControl" VerticalAlignment="Center"  Width="50" 
                  IsEditable="True"  Style="{StaticResource comboBoxStyle}">
            </local:PASCustomComboBox>
        <Button Height="23" Name="btnSearch" Width="25" Click="btnSearch_Click" Visibility="Collapsed" 
                VerticalAlignment="Center">...</Button>
        <Label Height="23" Name="lblDescription" VerticalAlignment="Center" Width="20" Foreground="Blue">
            
        </Label>
        
    </Canvas>
</UserControl>


Here PASCustomComboBox is a class which inherites from combo box.

public class PASCustomComboBox : ComboBox
{
    protected override void OnPreviewKeyDown(KeyEventArgs e)
    {
        if (e.Key == Key.Down || e.Key == Key.Up)
        {
            e.Handled = true;
            return;
        }

        base.OnPreviewKeyDown(e);
    }

}


Please help!
Thanks in advance!

Regards,

Samar
AnswerRe: Combo box inside a user control disappears when style is applied Pin
Ian Shlasko7-Sep-10 2:59
Ian Shlasko7-Sep-10 2:59 
GeneralRe: Combo box inside a user control disappears when style is applied Pin
dashingsidds7-Sep-10 3:36
dashingsidds7-Sep-10 3:36 
GeneralRe: Combo box inside a user control disappears when style is applied Pin
Ian Shlasko7-Sep-10 5:44
Ian Shlasko7-Sep-10 5:44 
QuestionHow to add simple C# user control to WPF project ? Pin
Yanshof6-Sep-10 4:48
Yanshof6-Sep-10 4:48 
AnswerRe: How to add simple C# user control to WPF project ? Pin
Kunal Chowdhury «IN»6-Sep-10 18:41
professionalKunal Chowdhury «IN»6-Sep-10 18:41 
GeneralRe: How to add simple C# user control to WPF project ? Pin
Yanshof6-Sep-10 18:56
Yanshof6-Sep-10 18:56 
GeneralRe: How to add simple C# user control to WPF project ? Pin
Kunal Chowdhury «IN»6-Sep-10 19:51
professionalKunal Chowdhury «IN»6-Sep-10 19:51 
GeneralRe: How to add simple C# user control to WPF project ? Pin
Yanshof6-Sep-10 19:55
Yanshof6-Sep-10 19:55 
AnswerRe: How to add simple C# user control to WPF project ? Pin
Abhinav S11-Sep-10 21:03
Abhinav S11-Sep-10 21:03 
AnswerRe: How to add simple C# user control to WPF project ? Pin
PumbaPumba27-Sep-10 6:54
PumbaPumba27-Sep-10 6:54 
QuestionTransform a model's positions directly Pin
Frank Boettcher5-Sep-10 23:38
Frank Boettcher5-Sep-10 23:38 
AnswerRe: Transform a model's positions directly Pin
Kubajzz6-Sep-10 0:11
Kubajzz6-Sep-10 0:11 
QuestionWpf Ribbon Control Pin
techaspnet5-Sep-10 20:18
techaspnet5-Sep-10 20:18 
AnswerRe: Wpf Ribbon Control Pin
Abhinav S11-Sep-10 2:51
Abhinav S11-Sep-10 2:51 
QuestionAuto completing multiple values separated by comma into a single autocompletebox. Pin
ananddayalan5-Sep-10 13:02
ananddayalan5-Sep-10 13:02 
AnswerRe: Auto completing multiple values separated by comma into a single autocompletebox. Pin
Abhinav S5-Sep-10 23:31
Abhinav S5-Sep-10 23:31 
QuestionCan't get rid of the scrollbar Pin
Yariv5-Sep-10 6:32
Yariv5-Sep-10 6: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.