|
Please specify what kind of panel you are using. Also, what are you using to show the elements, a ListBox?
Live in fragments no longer. Only connect.
|
|
|
|
|
No, I am not using any ListBox.
I am using Canvas with Usercontrols.
Regards,
- K (http://kunal2383.blogspot.com)
|
|
|
|
|
Hi,
How can I change the Isolated storage message/design windows when increasing the size of the isolated storage site?
Thanks,
Noam
|
|
|
|
|
Change the dialog that's presented to the user?
That's provided by the framework - you can't change it.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello Every One,
I want to develop a tetris game, if some could hep me that is going to be great, i did some ground work on the game and need help to develop it.
I dont know which control will help in achieving this, I already downloaded on article but unable to understand coz it. It is form codeproject and the link for that article is
Silverlight Tetris[^]
Please i need some help for this
or else you can directly mail me at ma_asimali@yahoo.co.in
waiting for your valuable reply
|
|
|
|
|
The source code for that game is down loadable via the link at the top of the article. DL it, read through it and learn. The article is pretty well written and should go a long way to helping you understand how it works.
If you have specific question about a part that you don't understand ask them, but a blanket 'I can't understand the article so please help...' is not really going to yield you much.
|
|
|
|
|
Thanks for reply
Do you mean the same link that i mentioned this my query.
if not please type the link.
The link that i mentioned is not well documented.
Because of which i am unable to follow the code.
waiting for your reply.
|
|
|
|
|
Hi
I have created a very nice treeview for my WPF app, but i would like it to auto hide when not in use so that i have more screen space to work with, then when i hover over it it should come into view. Can anyone help me out with this small issue?
|
|
|
|
|
|
Hi,
I have to develop Analog clock and Digital clock in WPF. These clocks should have an option to dynamically change the time format like IST,EST ect i.e., according to the location according to the user reqirement.
If any one have any idea on this please reply me.
Thanks in advance.
|
|
|
|
|
|
You're on form today!
Kevin
|
|
|
|
|
Hi,
I have a WPF application. In this i have to get the weather information of any place into my application. I came to know that by using webservices we can get the weathr information in to my application. By this I can display the weather information of any location.
If any one have any idea how to implement this please reply me soon.
Thanks in advance.
|
|
|
|
|
|
HI All, i wish begin to work about a feature new for me ,i'n my project i have a database( with SqlServer) and an application (developing in WPF) the purpose of this application is to manage/handle about Accountancy and others Departement,so i created a Passwords and Roles(for Users) to access in the application ,now i will create a system to knows how many Users are connected to the Application(via Database )and show that in a listBox(for example like a normal Chat Application i wish knows who is online and offline) but i don't know where i need begin to work out this feature ,i'm strange to this feature so if you have any suggestion,link and help i will appreciate so much your help.
Thanks so much.
P.S. if my question is not clear i will rewrite it...however sorry in anticipate
Best Regards
|
|
|
|
|
ascotravel wrote: i will create a system to knows how many Users are connected to the Application(via Database )
So you want to know the number of users connected to the database(SQL) ? Don't you think this post would be more appropriate in the Database[^] forum ?
See if this helps sp_who[^]
|
|
|
|
|
Hi aBitSmart,
i moved my post to the Database forum .
Thanks for your help.
|
|
|
|
|
Hi,
I am new to WPF. I want to implement drag and drop functionality in WPF. In this I will have some user controls, for these I should be able to dynamically drag and drop these controls to our desired location on the window.
Please reply me soon if you have any idea on this.
Thanks in advance
|
|
|
|
|
|
Dragdrop is an incredible annoyance in WPF since the events are fired practically randomly. Mousedown and mousemove may or may not be fired for child controls depending on how you databind them, and mousemove may be fired after a mousedown even if it didn't move at all.
I had to do it in a rather unelegant way because of this:
- Save the mouse location on previewmousedwn
- Compare this to the mouse position previewmousemove. If it's different and the button is still clicked, then find the child item for the originally clicked position, and do the dragdrop for it.
|
|
|
|
|
derm2 wrote: I had to do it in a rather unelegant way because of this:
- Save the mouse location on previewmousedwn
- Compare this to the mouse position previewmousemove. If it's different and the button is still clicked, then find the child item for the originally clicked position, and do the dragdrop for it.
Why is that "unelegant"? That's typically the way I've always seen the event handling
done for drag and drop, regardless of framework.
Yes, certain controls consume mouse events (and other events) as part of their implementation.
One needs to understand that and subscribe to the appropriate events, either bubbling or tunneling,
as necessary.
derm2 wrote: fired practically randomly
Hardly.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Starting your mousemove eventhandler with "if the mouse has moved" feels unelegant for me. I have never worked with a framework that fired mousemove events without the mouse moving before WPF.
|
|
|
|
|
derm2 wrote: Starting your mousemove eventhandler with "if the mouse has moved" feels unelegant for me
I guess I read your original post wrong because I saw
"Save the mouse location on previewmousedwn".
It's at that point I'd do hittesting or whatever necessary to
determine if it's the start of a drag situation, and if so, capture
the mouse.
derm2 wrote: I have never worked with a framework that fired mousemove events without the mouse moving before WPF.
I don't know what you're talking about there....there's no randomly fired
move events. Here's a very simple drag and drop example showing this:
<Grid >
<Canvas >
<TextBlock x:Name="textBlock" Text="0" Foreground="Black" />
<Rectangle Canvas.Left="30" Canvas.Top="30" Width="50" Height="50"
Stroke="Red" StrokeThickness="2" Fill="#00000000"
MouseLeftButtonDown="Rectangle_MouseLeftButtonDown"
MouseLeftButtonUp="Rectangle_MouseLeftButtonUp"
MouseMove="Rectangle_MouseMove" />
</Canvas>
</Grid>
Point anchorPoint;
Point currentPoint;
bool isInDrag = false;
int moveCount = 0;
private void Rectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
FrameworkElement element = sender as FrameworkElement;
anchorPoint = e.GetPosition(null);
element.CaptureMouse();
isInDrag = true;
e.Handled = true;
}
private void Rectangle_MouseMove(object sender, MouseEventArgs e)
{
moveCount++;
textBlock.Text = moveCount.ToString();
if (isInDrag)
{
FrameworkElement element = sender as FrameworkElement;
currentPoint = e.GetPosition(null);
double x = System.Convert.ToDouble(element.GetValue(Canvas.LeftProperty));
double y = System.Convert.ToDouble(element.GetValue(Canvas.TopProperty));
element.SetValue(Canvas.LeftProperty, x + currentPoint.X - anchorPoint.X);
element.SetValue(Canvas.TopProperty, y + currentPoint.Y - anchorPoint.Y);
anchorPoint = currentPoint;
}
}
private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (isInDrag)
{
FrameworkElement element = sender as FrameworkElement;
element.ReleaseMouseCapture();
isInDrag = false;
e.Handled = true;
}
}
No "fired mousemove events without the mouse moving" that I can see there.
Don't even have to check if the cursor moved because I know it did when I got the event...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Indeed. Your example doesn't fire that event, but it wouldn't be random if it always happened
Put this onto your form, and expand the root node. Mousemove will be fired, and you will start a drag operation if you don't check the position.
class Tree2 : TreeView
{
public Tree2()
{
TreeViewItem root = new TreeViewItem();
root.Header = "root";
TreeViewItem child = new TreeViewItem();
root.Items.Add(child);
this.Items.Add(root);
this.PreviewMouseDown += new MouseButtonEventHandler(Tree2_PreviewMouseDown);
this.PreviewMouseMove += new MouseEventHandler(Tree2_PreviewMouseMove);
}
Point lastMouseDown;
bool readyToDrag = false;
void Tree2_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
lastMouseDown = e.GetPosition(this);
readyToDrag = true;
}
void Tree2_PreviewMouseMove(object sender, MouseEventArgs e)
{
Point currentPosition = e.GetPosition(this);
if (readyToDrag)
{
if (currentPosition == lastMouseDown)
{
throw new Exception("This is a mousemove event fired for a mouseclick");
}
else
{
}
}
}
}
|
|
|
|
|
derm2 wrote: Put this onto your form, and expand the root node. Mousemove will be fired, and you will start a drag operation if you don't check the position.
That's not random.
Preview events are tunneling events - they go from root towards top of tree.
If you click in the treeview, the treeview gets a peek at the event before
the actual target control. You are responsible for dealing with that.
That's why I stated, and it's documented, that some controls consume the bubbling mouse
events like buttons, for example. Buttons take the bubbling events and convert them to the Click
event....the event is marked handled so an attached handler won't get called. So now one has
to use the tunneling event, which is simple for a standard button, but not so simple for a
treeview, which is a composite control (it is composed of many elements).
In this case you are getting messages meant for "child" elements within the treeview.
That's also why I stated you may have to do your own hittesting in the mousedown handler,
which wasn't necessary in my example, but is necessary in your example.
That hittesting can be as simple as this:
void Tree2_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
TreeView tv = e.Source as TreeView;
if (tv != null)
{
lastMouseDown = e.GetPosition(this);
readyToDrag = true;
}
}
You may need to do the same thing in the mousemove handler, but I personally
would capture the mouse so I know all the move events are mine until the button
is released.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|