Hi,
I want to implement XamComboEditor style same like I have mention for User Box in attached Image.I am calling "customValidationXamComboEditor" style from codebehind like shown below:
if (xcbServerName.SelectedItem == null) { xcbServerName.Style = Application.Current.FindResource("customValidationXamComboEditor") as Style; xcbServerName.UpdateLayout(); Border borderError = xcbServerName.Template.FindName("borderError", xcbServerName) as Border; if (borderError != null) { borderError.ToolTip = "Please select Server Name"; }
}
==============================
And here is my "customValidationXamComboEditor" style
------------------------------------------------
<Style x:Key="customValidationXamComboEditor" TargetType="igEditors:XamComboEditor"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igEditors:XamComboEditor"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="auto"/> </Grid.ColumnDefinitions> <Border Grid.Column="0" Name="Bd" Background="{TemplateBinding Background}" BorderBrush="Red" BorderThickness="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </Border> <Border Grid.Column="1" Name="borderError" Background="Red" DockPanel.Dock="right" Margin="0,0,-17,0" Width="12" Height="12" CornerRadius="6"> <TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="white"> </TextBlock> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
I want like, Border of xamComboEditor should be red and on right side it should be same Error indicator as I have shown for User Box in attached image when xamComboEditor.SelectedItem = null.
Please help me out.
Thanks in adv.
Hello Nisarg,
I am just checking if you require any further assistance on the matter.
Hello,
Thank you for your post. I have been looking into your question and I can suggest you use ‘Popup’ instead ‘Tooltip’ for the Border like e.g. :
<Style x:Key="customValidationXamComboEditor" TargetType="igEditors:XamComboEditor">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="igEditors:XamComboEditor">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Name="Bd" Background="{TemplateBinding Background}" BorderBrush="Red"
BorderThickness="1" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<Border Grid.Column="1" Name="borderError" Background="Red" DockPanel.Dock="right" Margin="0,0,-17,0" CornerRadius="6">
<TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="white">
</TextBlock>
<Popup IsOpen="True" x:Name="popup" Width="Auto" Height="Auto" PlacementTarget="{Binding ElementName=borderError}">
<StackPanel>
<TextBox Text="Please select Server Name"/>
</StackPanel>
</Grid>
</Popup>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Let me know, if you need any further assistance on this matter.