|
Hey people
Is there a way to programmatically show a ToolTip without hovering the mouse over a certain element?
I want to use this to draw the user's attention to certain areas at certain times.
Also, can I customize a ToolTip so that it looks like a MS Word Callout symbol/Chat balloon?
|
|
|
|
|
Showing a tooltip is not a good idea because it has a specific meaning to users, i.e. when you move over an item, it displays information. What I would suggest instead, is to use the AdornerLayer to display this information - which has the added advantage of you being able to style it however you want.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi this is sarath chandra.
I am very much new to wpf.
I have task to prepare a time sheet for media schedule.
In that i have to apply differnt background color to cells in datagrid depending on the condition.
Here no of rows and columns will change depends on the condition.
Can any body give solution for this task.
Thanks and Regards
Sarath Chandra
|
|
|
|
|
You will have to add Resource Dictionary say "DataGridStyle.xaml"
<pre><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
xmlns:Primitives="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit">
//Set the styles here
<Style x:Key="DatagridCellStyle" TargetType="toolkit:DataGridCell">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderBrush" Value="Blue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="LightGray" />
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" Value="Blue" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary></pre>
In App.xaml file
Add the resources
<pre><Application x:Class="ApplicationName" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="DataGridStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application></pre>
In your datagrid markup
add attribute
cellstyle = "{StaticResource DatagridCellStyle}"
I hope that helps,
Vsaratkar
|
|
|
|
|
I'm using a cascading dropdownlist using three tables. the code below works fine if my primary keys are numeric(integer) but my business rules want the primary keys to be alphernumeric(string).
[WebMethod]
public CascadingDropDownNameValue[] GetColors(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int colorId;
if (!kv.ContainsKey("Model") || !Int32.TryParse(kv["Model"],out colorId))
{
return null;
}
dsModelColorsTableAdapters.ModelColorsTableAdapter adapter = new dsModelColorsTableAdapters.ModelColorsTableAdapter();
dsModelColors.ModelColorsDataTable colors = adapter.GetColorsByModelId(colorId);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in colors)
{
values.Add(new CascadingDropDownNameValue((string)dr["ColorName"], dr["ColorID"].ToString()));
}
return values.ToArray();
}
How do I use my string primary key using the above code?
Please help an ajax technology adict.
ML Lingwati
|
|
|
|
|
Wrong message board!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey people
How can I show balloon tips in my wpf application? I know how to show them in the taskbar notfication area, but I want them to appear out of my other controls as well. If you want an example, open a webpage in Internet Explorer 8, then click on Compatibility View next to Refresh, then you'll see a balloon tip popping up out of the tab. I want to create a similar effect. I'm using a TabControl with various TabItems. Then somewhere in my application I have a context menu. When a certain item is selected from the context menu, a certain TabItem gets selected. Now to make it easier for the person that's going to be using my app, I want a balloon tip popping out of the newly selected tab to show that it has been selected.
Any hints?
Thanks
|
|
|
|
|
<Button ToolTip="This is a tooltip"/>
If I am not mistaken, all FrameworkElements have a Tooltip property.
A Tooltip is also a ContentControl.
Tooltip Class
|
|
|
|
|
I know how to show a ToolTip. What I want to know is how to show a BalloonTip? Similar to chat balloon's used in comics
|
|
|
|
|
Hi,
I am working on a silverlight application. In this I need to access the images in a folder in clientbin folder to the user control in the silverlight folder test1. I directly gave like this
FileInfo[] fileList;
imagesFolderPath += @"Images";
DirectoryInfo dir = new DirectoryInfo(imagesFolderPath);
fileList = dir.GetFiles("*.*");
Then I am getting an exception:"Attempt to access the method failed: System.IO.DirectoryInfo..ctor(System.String)"
If anyone have any idea to solve this i.e., to get the images from the folder in clientbin folder or any folder in test1.web folder(web application folder in silverlight) please reply me.
Thanks in advance.
|
|
|
|
|
Silverlight apps run on the client and the "clientbin" folder is on the server,
so your code couldn't possibly work.
You also are not supposed to use DirectoryInfo on the client. Even if you could,
you wouldn't be allowed to use its functionality in the restricted web sandbox.
Here's some info on different ways to access files from a Silverlight app:
Different ways for loading images and files in Silverlight 2 applications[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am working on a silver light application. In this I am using an WCF service. Its working fine in my local system. But we I place it in the server and run the application from another system then when I am using this service I am getting
System.Reflection.TargetInvocationException
I think this can be solved by changing the localhost name to server etc or some thing like this.
If anyone have any idea to solve this please reply me.
Thanks in advance.
|
|
|
|
|
It would be much more helpful if you posted the EXACT exception messages
(including inner exception(s)), your WCF configuration, some info on how
you're hosting the WCF service, etc...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Come join Scott Guthrie, Tim Heuer, Brad Abrams, Karl Shifflett and others for a Firestarter on Silverlight 3. A Firestarter gives you places to start in writing your application.
At this event we will focus on three areas:
What’s latest and greatest in with the latest release of Silverlight
What’s happening in the world of Expression 3, and
Give you a run down on .NET RIA Services, Toolkit, etc
The event is Thursday, September 17 in Redmond, WA. You can join in person or join on line.
For more information, see Join in Person or Online for Silverlight 3 Firestarter Event[^]
|
|
|
|
|
I have the code (below) which runs fine however, when the applications starts, I got those 3 warning on the output window:
--
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=RotateX; DataItem=null; target element is 'RotateTransform' (HashCode=14303791); target property is 'CenterX' (type 'Double')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=RotateY; DataItem=null; target element is 'RotateTransform' (HashCode=14303791); target property is 'CenterY' (type 'Double')
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=RotateAngle; DataItem=null; target element is 'RotateTransform' (HashCode=14303791); target property is 'Angle' (type 'Double')
--
Any clues on how to get rid of them?
Here is the code:
Window1.xaml
<Window
x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="Window1"
Background="White"
Height="300" Width="300">
<DockPanel>
<Button DockPanel.Dock="Bottom" Click="DoAdd">Add Item</Button>
<ItemsControl x:Name="itemsDisplay">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:DataItem}">
<Border
Background="{Binding Brush}"
Width="{Binding Width}"
Height="{Binding Height}"
>
<Border.RenderTransform>
<RotateTransform CenterX="{Binding RotateX}" CenterY="{Binding RotateY}" Angle="{Binding RotateAngle}"/>
</Border.RenderTransform>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Canvas.Left" Value="{Binding X}"/>
<Setter Property="Canvas.Top" Value="{Binding Y}"/>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</DockPanel>
</Window>
Window1.xaml.cs
using System.Windows;
namespace WpfApplication1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void DoAdd(object sender, RoutedEventArgs e)
{
itemsDisplay.Items.Add(new DataItem());
}
}
}
DataItem.cs
using System;
using System.Windows.Media;
using System.Reflection;
namespace WpfApplication1
{
public class DataItem
{
static Random RAND = new Random();
public DataItem()
{
X = RAND.Next(200);
Y = RAND.Next(200);
Width = 20 + 30 * RAND.NextDouble();
Height = 10 + 20 * RAND.NextDouble();
RotateAngle = 360 * RAND.NextDouble();
var brushes = typeof(Brushes).GetProperties(BindingFlags.Static | BindingFlags.Public);
Brush = brushes[RAND.Next(brushes.Length)].GetValue(null, null) as Brush;
}
public double X { get; set; }
public double Y { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public double RotateAngle { get; set; }
public Brush Brush { get; set; }
public double RotateX { get { return Width / 2; } }
public double RotateY { get { return Height / 2; } }
}
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
I haven't got VS installed at the moment but it looks like the errors are caused because the bindings are created before they have an object to bind to. You could try setting the FallbackValue of those bindings in XAML to 0.
|
|
|
|
|
|
DataTable dt = con.Fromdbase("Select * from DailyTrans");
dg.ItemsSource = (System.Collections.IEnumerable)dt.DefaultView;
dg is the WPF Datagrid
plz the above code works fine in my WPF c# app but i want to know weda this is the best
way of setting the data location for a grid dynamically
i rely don want to use the item binding..cos i want more control
Thanks
modified on Sunday, August 23, 2009 12:07 PM
|
|
|
|
|
prubyholl wrote: weda
prubyholl wrote: i rely don
This makes you look like a retard. There are 101 keys on your keyboard. Use them.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
wow..wot a way to answer a genuine question. thanks for wasting you time typing...
some codes are not optimized and would require much more processor time than
others though not significant for humans to realise but it can surely be seen in
very large db programs
thats wy i asked if any one could help comment..weda its the best
maybe i should have added 'Optimized'
and i guess
'u answered ####quite#### well'
|
|
|
|
|
prubyholl wrote: wot a way
prubyholl wrote: weda its the best
I didn't see anything wrong with your code, but, again, this sort of txt speak when you have a full keyboard in front of you, makes you look stupid. It has a real impact in if people will decide you're worth trying to help.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Alright.....
At last u have answered me now.. though i still don see wots wrong in tryna find da most optimized way
of doing things..i just don get my faults here.
and your tone-am sure thats how u were brought up.
|
|
|
|
|
prubyholl wrote: though i still don see wots wrong in tryna find da most optimized way
I'm sorry, the more you talk like that, the more I think you're a moron. There's a standard of professional conduct that does not include txt speak. This is fine for your 14 year old girlfriend. Not fine for posting in professional forums.
prubyholl wrote: am sure thats how u were brought up.
Yes, I was brought up to uphold standards of behaviour, and not pander to the lowest common denominator.
By all means, talk like a retard. You'll notice I'm the only person who answered you. I'd like you to at least consider that if you spoke like a grown up, you might get more replies and people wouldn't write you off as a script kiddie.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i cannot believe this..
alright whatever man...
|
|
|
|
|
Oh i didnt know u were 40 years and you talked like that ..
Frustration must be killing you.
Anyway thanks for letting me know am not supposed to use txt here.
|
|
|
|