Wednesday, September 26, 2012

Silverlight 4 custom control (Button, TextBox and ComboBox)

Silverlight 4 custom control (Button, TextBox and ComboBox)

In my custom control, I have one Button, TextBox and ComboBox and loaded the custom control at run time successfully. When I am selecting the item from the combo box – position of the drop down menu move left side. I want open drop down menu exactly under the combo box.

Please Help....

Below code is my custom control - Generic.xaml file:

<Style TargetType="control:TextBox">     <Setter Property="Template">         <Setter.Value>             <ControlTemplate TargetType="control:TextBox">                 <StackPanel Orientation="Horizontal">                     <Button Name="GotoIcon" Cursor="Hand" VerticalContentAlignment="Top" IsTabStop="False" />                     <StackPanel Orientation="Horizontal">                         <Border x:Name="Border" Opacity="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Width="{TemplateBinding TextBoxWidth}">                             <ScrollViewer x:Name="ContentElement" BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}"/>                         </Border>                         <ComboBox x:Name="ComboElement" IsTabStop="True" BorderThickness="0" Padding="{TemplateBinding Padding}" Visibility="Collapsed" Width="{TemplateBinding TextBoxWidth}"/>                     </StackPanel>                 </StackPanel>             </ControlTemplate>         </Setter.Value>     </Setter> </Style> 

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog