Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
XamComboEditor Style
posted

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.

  • 35319
    posted

    Hello Nisarg,

     

    I am just checking if you require any further assistance on the matter.

  • 35319
    posted

    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>

                                    </Border>

                                    <Popup IsOpen="True" x:Name="popup" Width="Auto" Height="Auto" PlacementTarget="{Binding ElementName=borderError}">

                                        <Grid>

                                            <StackPanel>

                                                <TextBox  Text="Please select Server Name"/>

                                            </StackPanel>

                                        </Grid>

                                    </Popup>

                                </Grid>

                            </ControlTemplate>

                        </Setter.Value>

                    </Setter>

                </Style>

     

     

    Let me know, if you need any further assistance on this matter.