ShowDuration attribute cannot resolve in tooltip at silverlight 4 - silverlight

i want use to ShowDuration attribute in a tooltip at silverlight project. but ShowDuration not exist in ToolTip control
for example:
<Button x:Name="btnAppUserRoleAdd" Style="{StaticResource GlassButton}" Content="button" Width="100" Height="36" Margin="0 0 40 0">
<ToolTipService.ToolTip>
<ToolTip ShowDuration="10000" Template="{StaticResource ToolTipTemplate}" HorizontalOffset="2" VerticalOffset="5">
<ToolTip.Content>
<TextBlock Text="any test"
TextWrapping="Wrap" Style="{StaticResource ButtonTooltipFontStyle}" />
</ToolTip.Content>
</ToolTip>
</ToolTipService.ToolTip>
"ShowDuration="10000" this attribute have not known by intellisence in VS2010 and that say: cannot resolve symbol ShowDuration
my tooltip without ShowDuration working properly and not problem. but i want use this attribute. of course, i use tooltip class in code (c#) but problem not solved.
please help me
i use silverlight4, visual studio 2010.

The Silverlight implementation of a ToolTip does not have a ShowDuration property.

The referenced Tooltip opensource lib has big problem when use with Silverlight DataGrid control, it open many tooltips which are not closed when mouse moved away, it can open many of the same tooltips if you you move mouse arround in a cell. We are forced to take it out from project. We are still looking for a solution just to extend the display duration of tooltips.

Here is a Advanced Silverlight Tooltip Control. This Tooltip has the DisplayTime property. Maybe it is helpful.
You have to download the dll file and reference it.

Silverlight tooltips currently don't have the extended functionality that WPF provide to set delay or duration.
As much as I'd like to see this functionality baked into Silverlight, I've had to build something myself. This also meant I had to create my own ToolTipService as lots of the code I needed to hook into was internal.
Replace your references to ToolTipService and ToolTip to the ones in the library and you'll get more properties to exploit :-)
You can find it on Codeplex as well as on NuGet.
Hope that helps!
Cheers,
Xavier

Related

Is there any free Visual Studio plug-in/extension or external program to visualize XAML DataTemplate?

Visual Studio (10) gives the expected message "Intentionally Left Blank" in the designer.
I know already that I can do this with Blend, just looking around if there is an alternative solution...
I don’t really mind to graphically edit the template; I want only to see it without having to run the application.
Thanks!
Not exactly what you might want, but you can use XamlPad and just paste the content of your datatemplate into it. As long as you don't have layout related bindings, it should work well. Bindings are just ignored by xamlpad, and you need to add the 2 wpf namespace aliases by hand.
for example:
<TextBlock xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Text="{Binding test}"
Background="Red"
Width="20" Height="20"/>
the textblock is empty in XamlPad, but everything else works as expected.

using autocomplete box in silverlight?

i am currently displaying data in the radgrid controls of telerik, i want to add an autotextbox over the column named "Name". how can i do this?
my radgrid only displays data and i want that whenever user enters into textbox a list of name pops up just like in stackoverflow web site.
please help..i have been using silverlight,wcf ria services,telerik controls.
You can use the AutoComplete textbox from the Silverlight 4 Toolkit. The toolkit is an advanced set of controls that are not part of the core Visual Studio library. To download & install, you can head here. Once you have it installed, you add a project reference to System.Windows.Controls add this to your UserControl declaration:
xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
This gives you a reference point for the Silverlight Toolkit, specifically the input controls. Once that's done, here is an example of using the autocomplete textbox:
<input:AutoCompleteBox IsTextCompletionEnabled="False" HorizontalAlignment="Left" ItemsSource="{StaticResource SampleEmployees}" SelectionChanged="OnSelectionChanged"/>
This comes directly from the documentation from the Silverlight Toolkit. Link here. Click the 'AutoCompleteBox' in the left menu (under heading: Input). Once loaded, you can view the XAML/C# by clicking on any one of the items at the bottom of the window, such as 'AutoCompleteBoxSample.xaml' or 'AutoCompleteBoxSample.xaml.cs' This should give you the start/code you're looking for.
In your case, you'll also need to create a cell template for the radgridview. Here's a quick sample of what that might look like:
<radControls:RadGridView x:Name="registerGridView"
AutoGenerateColumns="False">
<radControls:RadGridView.Columns>
<radControls:GridViewToggleRowDetailsColumn />
<radControls:GridViewDataColumn Header="Client" />
<radControls:GridViewDataColumn Header="Site" />
<radControls:GridViewDataColumn Header="Name">
<radControls:GridViewDataColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<input:AutoCompleteBox HorizontalAlignment="Left" ItemsSource="{Binding Names}" SelectionChanged="OnSelectionChanged"/>
</StackPanel>
</DataTemplate>
</radControls:GridViewDataColumn.CellTemplate>
</radControls:GridViewDataColumn>
</radControls:RadGridView.Columns>
</radControls:RadGridView>

Remove the "blockiness" in Progress Bar in WPF

I want to remove the spaces between the blocks showing the progress.
I need it to be solid.
Code:
<ProgressBar Name="probar" Minimum="0" Height="40" BorderThickness="0"/>
Geetha
You need to redefine the template of the ProgressBar. Fortunately, it's not very complex... The simplest way is to extract the template with a tool like Style Snooper, the BAML Viewer Reflector Add-in, or Show Me The Template, and change the part that defines the background.

WPF Binding Help

I haven't used WPF that much so the solution to this is probably pretty easy.
In the ide I'm developing it will have multiple controls(text editor) each being hosted in a tab, much like VS does for each source file. When the user clicks new the "host" creates a new EditorWindow(a usercontrol), creates a new tab, and tells the tab to display the EditorWindow it created, and then updates a property called currentWindow (of type EditorWindow) with the one that's currently active. Inside the EditorWindow is the text editor whose name is textEditor(also a property). What I'm trying to do is take this code from the quick start source of the text editor control I'm using
<StackPanel>
<CheckBox Checked="EditiorOptionsChecked" IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsIndicatorMarginVisible}" Content="Indicator margin visible" />
<CheckBox Checked="EditiorOptionsChecked" IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsLineNumberMarginVisible}" Content="Line number margin visible" />
<CheckBox Checked="EditiorOptionsChecked" IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsRulerMarginVisible}" Content="Ruler margin visible (useful for fixed-width fonts only)" />
<CheckBox Checked="EditiorOptionsChecked" IsChecked="{Binding ElementName=Control, Path=currentWindow.textEditor.IsSelectionMarginVisible}" Content="Selection margin visible" />
</StackPanel>
put that in the host controls xaml, and bind the checkboxes to the syntax editor. I've tried a couple different things to no avail. Control is the name of the window hosting all the tabs, and path is obviously supposed to be the property that the checkboxes are bound too. I'm pretty sure the problem is that at initial run-time currentWindow isn't initialized so therefore my bindings aren't ever getting updated, but I'm at a loss as to how to fix this issue. Thanks!
Since you are new to WPF, you may not know that properties have to implement some sort of change notifications in order for bindings to work. For instance, if any of the properties in the the path "currentWindow.textEditor.IsIndicatorMarginVisible" change, you need to inform the binding engine that it has changed. If you implement these properties as DependencyPropertys, the change tracking comes for free. Otherwise, you should implement INotifyPropertyChanged.
I've found that the Snoop utility is the easiest way to do quick binding debugging, you should try using it and see if it tells you anything useful on the bound properties.

Fixing Tim Heuer's EditableComboBox for SL3 & latest SL Toolkit

I'm using Tim Heuer's style to get an editable combo box from here:
http://timheuer.com/blog/archive/2008/11/05/silverlight-editable-combobox-using-styles.aspx
This is working well in my project circa the previous release of the Silverlight Toolkit. Unfortunately, attempting to use this style with SL3 RTM and the latest SL Toolkit doesn't work. I suspect that the problem has to do with this: "Breaking Change: The "DropDownToggle" template part of type ToggleButton has been removed." I'm not sure how to fix it to get the drop down part to work again, any ideas?
For me it works now. I added this line to ToggleButton declaration in EditableComboStyle template:
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen, Mode=TwoWay}"
Also it is important to change the ListBox name to x:Name="Selector" in the same EditableComboStyle template like Jeff said. Then the control is used as:
<toolkit:AutoCompleteBox MinimumPrefixLength="0"
MinimumPopulateDelay="200"
x:Name="editableCombo"
Style="{StaticResource EditableComboStyle}"
Text="{Binding MyProperty, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" />
But unfortunately when the desired editable combobox behavior works, other issues appears:
I have problem with immediate binding when user click on toogle button which causes immediate validation before any item is selected or text written.
User have to press tab twice for move to other control.
If you take a look inside of the Silverlight Toolkit C# samples (for the latest July 2009 release), you'll see that the editable combo box sample has changed some. You are correct that the breaking change is the reason for this.
The ToggleButton still exists in the custom template for the control, but you need to hook up to the Click event in your code-behind file, and actually toggle the IsDropDownOpen value in your code.
This change was made to be consistent: having the control support template parts that are not in the default control template was decided to be against good design guidelines for controls, so I removed it for the final release of Silverlight 3.
I'm sorry it's caused some trouble, and hope that updating your application is easy enough!
Also, be aware that in any custom control templates, with the July 2009 release of the Silverlight Toolkit for Silverlight 2 (or the Silverlight 3 SDK), the AutoCompleteBox's ListBox template part has been renamed to "Selector" from "SelectionAdapter", so you may need to rename your ListBox template part in your own styles.
I had a bit of trouble putting the fixes together for SL3 (I couldn't find it in one place) so for anyone else I will leave my working version here:
http://walkersretreat.co.nz/files/SLComboEdit3.zip
This includes the fix for the tabstop.
There is nothing new in here - just put together what others have said in one place.
Khyalis on Tim Heuer's blog seems to have fixed this by binding IsChecked on the DropDownToggle:
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen, Mode=TwoWay}"
So far it works for me.
IsTabStop=false on the AutoCompleteBox will fix the tab issue.
The TextBox (inside the AutoCompleteBox template) will still get focus on tab.

Resources