|
Thanks. I found what I wanted in the Dispatcher class (which class Application uses). I needed to see more than I thought, because there is so much important code, however, what I originally was looking for was basically the following in Dispatcher.PushFrameImpl():
while(frame.Continue)
{
if (!GetMessage(ref msg, IntPtr.Zero, 0, 0))
break;
TranslateAndDispatchMessage(ref msg);
}
From this code I was led to learn about thread Frames and such.
|
|
|
|
|
Has anyone that knows what WPF Application.Run() does written a C# function that duplicates what it does? Can you point me to that code? Thanks.
|
|
|
|
|
I already told you the answer. I also suggested that you explain what problem you are trying to solve.
|
|
|
|
|
Where did you tell me everything what Application.Run() does and how it does it? If you can't understand my question or don't know the answer to my question, then I would like an answer from someone who does.
|
|
|
|
|
I told you where to find the information. Whatever that method does is internal to Microsoft, so they are the people to answer the question. What you have still not done, is to explain exactly what problem (if you actually have one) you are trying to solve.
|
|
|
|
|
You could always take a look at the publicly available[^] reference source code.
This space for rent
|
|
|
|
|
|
I'm old. That took me a minute to translate
You are most welcome.
This space for rent
|
|
|
|
|
I'm trying to drag a user control around a canvas. I want to prevent the user from dragging the control outside the canvas.. See my comment in green.
private void Control_MouseMove(object sender, MouseEventArgs e)
{
var draggableControl = sender as UserControl;
if (isDragging && draggableControl != null)
{
Point currentPosition = e.GetPosition(this.Parent as UIElement);
var transform = draggableControl.RenderTransform as TranslateTransform;
if (transform == null)
{
transform = new TranslateTransform();
draggableControl.RenderTransform = transform;
}
var newX = currentPosition.X - clickPosition.X;
if (newX < 0)
{
newX = 0;
}
if (newX > parent.ActualWidth)
{
newX = parent.Width - this.Width;
}
transform.X = newX;
transform.Y = currentPosition.Y - clickPosition.Y;
}
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Can't you get the position and size of the containing element (canvas) in relation to the window and massage those values into you control position.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I can get a reference to the Canvas, but it doesn't have Left or Top properties.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I describe, is the Edge Browser window tab, drag and drop out to generate a new form, the drag process mouse followed by a label image. What can I do to achieve a similar drag-and-drop operation?
What can I do to achieve the following functions, do you really want to use the mouse hook, Microsoft itself should not be in the UWP program to use Win32 things.
The main thing is that WPF mouse-moving event cannot be triggered outside the window.
|
|
|
|
|
|
This project doesn't solve the problem I'm asking, I need to drag a control or item out of the window and create a new window.
|
|
|
|
|
Maybe you're using the "wrong gesture".
"Drag and drop" is not something one associates with "creating a new window".
One "creates a window" and then "places" it somewhere; not the other way around (dragging "something" that "spawns" a window).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
It's a common UI trick used in applications such as Chrome and Visual Studio. A tab is dragged out of the app to create a new shell.
This space for rent
|
|
|
|
|
Sure; but what we "see" happening may have no bearing on the actual implementation.
He wants to "drag a control" outside the scope of the application.
If instead he used a "proxy" window, he could accomplish what he wanted.
But if one is only fixated on the "image of a control" ...
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
So you have the right example or demo, and I want to see how it works.
|
|
|
|
|
The way to handle this is to have the window itself act as the drop target. When the DragLeave[^] event is raised, create a new Window and add that tab into that window. There's a lot of code that you're going to have to write here - when I've done it, I've written it for clients so they own that code so I can't share it with you. You can see from this what you need to do so you should be able to cope with the actual mechanics of it yourself.
This space for rent
|
|
|
|
|
Hi, maybe everybody can help me with Dependency Properties and a custom Control, this costumer Control contains a grid, the grid shall be created progammatically- new columns with Buttons and external controls.
I have a dependency properties in this custom Control, but when i call the custom Control then the grid doesn't change.
It seems I have no accessto the grid? Because nothing will created in the grid, no column, no button. What do I wrong?
What I have tried:
my dependency property :
public static DependencyProperty Symbol1Name =
DependencyProperty.Register("Sym1Name", typeof(string), typeof(UserControl1), new FrameworkPropertyMetadata("test", OnSymbol1PropertyChanged))
public string Sym1Name
{
get { return (string)this.GetValue(UserControl1.Symbol1Name); }
set { this.SetValue(UserControl1.Symbol1Name, value); }
}
The onChange Function
private static void OnSymbol1PropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
UserControl1 ak = dependencyObject as UserControl1;
ak.OnPropertyChanged("Symbol1Name");
ak.OnSymbol1PropertyChanged(e);
}
The function to Change works in normal WPF App:
private void OnSymbol1PropertyChanged(DependencyPropertyChangedEventArgs e)
{
try
{
change(Sym1Name, 0);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
The XAML:
<Grid x:Name="Grid1" Grid.Column="1" Background="Gray" Margin="5,0,0,0" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
</Grid>
|
|
|
|
|
|
It is possible to show group summary rows in a standard WPF Data Grid? I've been Googling and I can't see to find what I'm looking for.
Do I need a third party grid for this? If so, any suggestions?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: It is possible to show group summary rows I presume you mean Sub Total rows - not sure if the standard DG will do it but the Telerik one certainly does.
Actually I will bet every commercial DG will have that feature.
Google foo wpf datagrid grouping subtotal - Google Search[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks. I was hoping to not have to buy one.
BTW, why did you post a Google search? Not sure what that's for when I already said I Googled it.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: I already said I Googled it Missed that and it looked like there was some reasonable hacks to the standard DG. I have used Gerry's suggestion in the past, inserting total rows manually, it may not be grouping but you do get the sub totals.
Never underestimate the power of human stupidity
RAH
|
|
|
|