Hi,
I have a Combobox as UserControl,
In combobox,we have one textbox,2 buttons.While resizing combobox it gets resize but its contents resized when we
chenge combobox size and after clicking on control.
I want it will resize with Combobox.
<Grid ><ComboBox Name="cmb" HorizontalAlignment="Left" Height="20" MaxDropDownHeight="100" IsSynchronizedWithCurrentItem="True" HorizontalContentAlignment="Stretch" IsEditable="True" VerticalAlignment="Top" Width="{Binding Path=Width.AdjustedValue, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Path=FreeTextList,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" SelectionChanged="cmb_SelectionChanged" SelectedItem="{Binding Path=SelectedComboBoxItem,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextSearch.TextPath="SelectedComboBoxItem.CurrentLanguageContent"> <ComboBox.ItemTemplate><DataTemplate ><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="*"></ColumnDefinition></Grid.ColumnDefinitions><TextBlock Name="tblk" DataContext="{Binding}" HorizontalAlignment="Left" Text="{Binding CurrentLanguageContent}" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" MaxWidth="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}, Path=ActualWidth}"/><Button Name="btnDel" HorizontalAlignment="Right" DataContext="{Binding}" Style="{StaticResource IconButtonStyle}" VerticalAlignment="Top" MinWidth="20" Width="20" common:CreateCommandBinding.Command="{Binding Path=DataContext.DeleteLangTextCmd, RelativeSource={RelativeSource AncestorType=ComboBox}}" CommandParameter="{Binding}" Height="18" ToolTip="Add" ><Button.Content><Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button} }" OpacityMask="{DynamicResource DeleteIcon}"/></Button.Content></Button></Grid></DataTemplate></ComboBox.ItemTemplate></ComboBox><StackPanel Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="20" Width="{Binding Path=ContainerWidth, Mode=OneWay,NotifyOnSourceUpdated=True}" ><afw:LanguageTextBox Name="txtElement" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Margin="0,0,0,0" AcceptsReturn="True" DataContext="{Binding}" IsReadOnly="{Binding Path=IsEditable, Mode=OneWay, Converter={StaticResource InverseBooleanConverter} }" Visibility="{Binding Path=IsWritable, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter} , ConverterParameter=True}" MultiLangTexts="{Binding ExpandedLangTextValues.Value, Converter={StaticResource StringArrayToCollectionConverter}, Mode=TwoWay}" DefaultLanguage="{Binding Path=CurrentLanguageIndex, Mode=OneWay}" Identifiers="{Binding Path=LanguageIdentifiers, Mode=OneWay}" Width="{Binding Path=SetLangWidth, Mode=OneWay,NotifyOnSourceUpdated=True}" VerticalAlignment="Top" TextWrapping="WrapWithOverflow" Style="{StaticResource localContentElementText}" Cursor="{Binding Path=Cursor}" FontFamily="{Binding Path=CurrentFontFamily.Value, Mode=OneWay, Converter={StaticResource StringToFontFamilyConverter}}" FontStyle="{Binding Path=CurrentFontStyle.Value, Mode=OneWay}" FontWeight="{Binding Path=CurrentFontWeight.Value, Mode=OneWay}" FontSize="{Binding Path=CurrentFontSize.Value, Mode=OneWay}" Foreground="{Binding Path=CurrentFontColor.Value, Mode=OneWay}" TextDecorations="{Binding Path = TxtDecoration.Value}" TextAlignment="Left"><afw:LanguageTextBox.ContextMenu><ContextMenu x:Name ="txtContextMenu" Style="{StaticResource ContextMenuStyle}" Visibility="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget.DataContext.ReportDefinition.Main.IsInEditMode, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=True, FallbackValue=Collapsed}"><MenuItem Name="mnuDelete" Header="{LocText props:Resources.DELETE}" Style="{StaticResource ContextMenuItemStyle}" DataContext="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" common:CreateCommandBinding.Command="{Binding Path=DeleteElementCmd}"/><MenuItem x:Name ="cut" Header="{LocText props:Resources.WORK_SPACE_PARTIAL_SECTION_CUT}" Style="{StaticResource ContextMenuItemStyle}" DataContext="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" Command="ApplicationCommands.Cut" CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type afw:LanguageTextBox}}}" /><MenuItem x:Name ="copy" Header="{LocText props:Resources.WORK_SPACE_PARTIAL_SECTION_COPY}" Style="{StaticResource ContextMenuItemStyle}" DataContext="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" Command="ApplicationCommands.Copy" CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type afw:LanguageTextBox}}}" /><MenuItem x:Name ="paste" Header="{LocText props:Resources.WORK_SPACE_PARTIAL_SECTION_PASTE}" Style="{StaticResource ContextMenuItemStyle}" DataContext="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" Command="ApplicationCommands.Paste" CommandTarget="{Binding RelativeSource={RelativeSource AncestorType={x:Type afw:LanguageTextBox}}}" /><MenuItem Header="{LocText props:Resources.RPT_SNAPIN_POSITION}" Style="{StaticResource ContextMenuItemStyle}" DataContext="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" common:CreateCommandBinding.Command="{Binding Path=ReportDefinition.Main.DialogInvocation.PositionEditCmd}"/><MenuItem Header="{LocText props:Resources.RPT_SNAPIN_FONT}" Style="{StaticResource ContextMenuItemStyle}" DataContext="{Binding Path=PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" common:CreateCommandBinding.Command="{Binding Path=ReportDefinition.Main.DialogInvocation.FontEditCmd}"/><MenuItem Header="{LocText props:Resources.WORKSPACE_ELEMENT_MOVE}" IsEnabled="{Binding IsWritable}" Style="{StaticResource ContextMenuItemStyle}" Visibility="{Binding Path=CurrentSelectedElement.IsInBody, Converter={StaticResource BooleanToVisibilityConverter} , ConverterParameter=True}" DataContext="{Binding Path=ReportDefinition}"><MenuItem Header="{LocText props:Resources.MOVE_UP}" Style="{StaticResource ContextMenuItemStyle}" common:CreateCommandBinding.Command="{Binding Path=LayoutDefinition.PageContentSection.MoveUpCmd}"/><MenuItem Header="{LocText props:Resources.MOVE_DOWN}" Style="{StaticResource ContextMenuItemStyle}" common:CreateCommandBinding.Command="{Binding Path=LayoutDefinition.PageContentSection.MoveDownCmd}"/><MenuItem Header="{LocText props:Resources.MOVE_TOP}" Style="{StaticResource ContextMenuItemStyle}" common:CreateCommandBinding.Command="{Binding Path=LayoutDefinition.PageContentSection.MoveTopCmd}"/><MenuItem Header="{LocText props:Resources.MOVE_BOTTOM}" Style="{StaticResource ContextMenuItemStyle}" common:CreateCommandBinding.Command="{Binding Path=LayoutDefinition.PageContentSection.MoveBottomCmd}"/></MenuItem></ContextMenu></afw:LanguageTextBox.ContextMenu></afw:LanguageTextBox><Button Name="btnAdd" Style="{StaticResource IconButtonStyle}" VerticalAlignment="Top" MinWidth="20" Width="20" common:CreateCommandBinding.Command="{Binding Path=AddMultilangTextCmd}" ToolTip="Add" HorizontalAlignment="Right"><Button.Content><Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button} }" OpacityMask="{DynamicResource NewIcon}"/></Button.Content></Button><Button Name="btnEdit" Width="20" Style="{StaticResource IconButtonStyle}" VerticalAlignment="Top" MinWidth="20" common:CreateCommandBinding.Command="{Binding Path=UpdateLangTextCmd}" ToolTip="Update" HorizontalAlignment="Right"><Button.Content><Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button} }" OpacityMask="{DynamicResource EditModeIcon}"/></Button.Content></Button></StackPanel>
Thanks and Regards,
Rosy D