hi,
I have created template column throught code-behind .In that i custmize the headerTemplate.It contain Image and textbox which placed in stackpanel container.In image we add Tool Tip. It is working with Default style of grid but if i apply custum style to grid then ToolTip is not seen.
Please give the solution....
Thanks in advanced
Hi,
Do you have a sample that shows this problem?
-SteveZ
I write this code in objGrid_ColumnLayoutAssigned
// Code for Cell Template
StringBuilder CellETemp = new StringBuilder();
CellETemp.Append("<DataTemplate ");
CellETemp.Append("xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'");
CellETemp.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>");
CellETemp.Append(" <Grid x:Name=\"LayoutRoot\" Background=\"Transparent\" Width=\"119\">");
CellETemp.Append(" <Grid.ColumnDefinitions>" );
CellETemp.Append(
" <ColumnDefinition x:Name=\"ColValue\" Width=\"117\"></ColumnDefinition>");
" </Grid.ColumnDefinitions>");
" <TextBox x:Name=\"txtValue\" HorizontalAlignment=\"Center\" TextAlignment=\"Right\" Text=\"{Binding " + strHeader + " ,Mode=TwoWay}\" VerticalAlignment=\"Center\" Grid.Column=\"0\" Height=\"20\" Width=\"105\" Background=\"#FFF7F8F8\"></TextBox>");
" </Grid>");CellETemp.Append(" </DataTemplate>");
// Code For Header Template
StringBuilder HeaderTemp = new StringBuilder();
HeaderTemp.Append(
"<DataTemplate ");
"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ");
"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:tooltip='clr-namespace:Silverlight.Controls;assembly=ExtendedControls'> ");
" <StackPanel Orientation= \"Horizontal\">");
" <TextBlock x:Name=\"txtNormal\" Text=\"{Binding Converter={StaticResource HeaderConverter}, ConverterParameter='" + strPeriod + "'}\" HorizontalAlignment=\"Right\" />");
" <Image x:Name=\"imgNotes\" Source= \"../../images/notes.jpg \" Height=\"11\" Width=\"11\" >");
" <tooltip:ToolTipService.ToolTip>" +"<tooltip:ToolTip InitialDelay=\"0\" ShowDuration=\"30\">"+ "<TextBlock x:Name=\"txtNotes\" Text=\"TooltipTest\" Width=\"90\" FontSize=\"11\" FontFamily=\"Arial\" VerticalAlignment=\"Top\" TextAlignment=\"Left\"/>"+"</tooltip:ToolTip>"+"</tooltip:ToolTipService.ToolTip>");
" </Image>");
" </StackPanel>");
" </DataTemplate>");
e.ColumnLayout.Columns.Add(
HeaderText = app.objBizDisplay.PeriodNameDictionary[app.objBizDisplay.ArrPeriodID[icrt]],Key = strHeader, MinimumWidth = 60,
Width =
new ColumnWidth(iWidth, false),IsSortable = false ,IsResizable =true,
HeaderTemplate = (
DataTemplate)XamlReader.Load(HeaderTemp.ToString()),
ItemTemplate = (
DataTemplate)XamlReader.Load(CellTemp.ToString()) });
this code working with Degault Style and i get ToolTip on headerColumn Image of XamGriD.
But If i apply style for Grid either at desinTime or Runtime the Tooltip is not seen
Please Reply...
The more information you can provide upfront the better. And if you have a sample that you can send, we can generally get to the bottom of a problem a lot quicker.
I still need more information from you. Like what are you setting a style on. What style are you setting? What are you doing in the style etc...
Really if you could attach a sample that would be best.
Thanks,
I am sending you the style.
Everything is working fine but when i apply this style tooltip is not seen on header.
<Style x:Key="BlueHeaderStyle" TargetType="igPrim:HeaderCellControl"> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Foreground" Value="#FFFFFFFF" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igPrim:HeaderCellControl"> <igPrim:SimpleClickableContainer x:Name="NormalFill" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" >
<Grid x:Name="RootElement" Cursor="Hand" > <Grid.Background> <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"> <GradientStop Color="#FF6CA2DF"/> <GradientStop Color="#FF92BAE7" Offset="1"/> </LinearGradientBrush> </Grid.Background> <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions>
<vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="Normal"> <Storyboard FillBehavior="HoldEnd"> <DoubleAnimation Duration="00:00:00.5" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="Opacity" To="0" /> <DoubleAnimation Duration="00:00:00.001" Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="Opacity" To="0" /> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="MouseOver"> <Storyboard FillBehavior="HoldEnd"> <DoubleAnimation Duration="00:00:00.25" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="Opacity" To="1" /> <DoubleAnimation Duration="00:00:00.001" Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="Opacity" To="0" /> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Pressed"> <Storyboard FillBehavior="HoldEnd"> <DoubleAnimation Duration="00:00:00.001" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="Opacity" To="0" /> <DoubleAnimation Duration="00:00:00.001" Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </vsm:VisualState> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups>
<Border x:Name="MouseOverElement" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0"> <Border.Background> <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"> <GradientStop Color="Red" Offset="0"/> <GradientStop Color="Green" Offset="1"/> </LinearGradientBrush> </Border.Background> </Border> <Border x:Name="PressedElement" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0" Background="#FF585858" />
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" > </ContentPresenter> <Rectangle x:Name="Resizer" Opacity="0" Fill="AliceBlue" Width="5" Grid.Column="1" StrokeThickness="10" Cursor="SizeWE" HorizontalAlignment="Right" VerticalAlignment="Stretch" />
<Rectangle x:Name="Dragger" Opacity="0" Stretch="Fill" Fill="AliceBlue" Grid.Column="0" StrokeThickness="10"/> </Grid> </igPrim:SimpleClickableContainer> </ControlTemplate> </Setter.Value> </Setter> </Style>
Thanks for the style.
The issue is that your ContentPresenter is being hidden by your Resizer/Dragger elements, if you put them under the ContentPresenter the tooltip will show up:
<Rectangle x:Name="Resizer" Opacity="0" Fill="AliceBlue" Width="5" Grid.Column="1" StrokeThickness="10"
Cursor="SizeWE" HorizontalAlignment="Right" VerticalAlignment="Stretch" />
<Rectangle x:Name="Dragger" Opacity="0" Stretch="Fill" Fill="AliceBlue" Grid.Column="0" StrokeThickness="10"/>
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" >
</ContentPresenter>
Thanks SteveZ
It just shouldn't have anything positioned over it. It doesn't have to be last.
So you mean ContentPresenter should be last at the ControlTemplate......
I believe it's b/c the mouse is being handled on the Dragger rectangle, which mean the tooltip is not getting notified that the mouse is over the contentPresenter.
Thank you Steve... Its Work.
But please can u explane me what was the issue.Because i commented Dragger Rectangle then it was also worked.
I havent worked so much on style,ContentPresenter,ControlTemplate etc. so please explane . . .