For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
I have a window with 2 anchorable panes (one left and one at the bottom) and a documentPane. I use MVVM.
So I set the DocumentsSource and AnchorablesSource properties of DockingManager. The collection in AnchorablesSource
only binds to the left anchorable pane. I do not how to bind models to the second anchorable
How do I have to set up the xaml so that I have control over the binding of the anchorable panes?
There is a timer that moves the InnerCanvas to the left at regular intervals. This is Live mode.
The Now line is a child of the InnerCanvas, so that when the user slides it, the Now line will move also. Once the user slides the InnerCanvas, the control is then in History Mode. A History line appears when the Now line is and the Now line moves right with the timer ticks. So basically the user can see where Now WAS and where it IS relative to the slide amount.
In addition, in Live Mode, when the Now line is 3/4 of the way into the current period (1 Day, 3 Days, 5 Days), then an additional period is added to the right.
The problem is that in Live Mode, the now line should ALWAYS be 200 relative to the right side of the OutterCanvas.
There's got to be a way to know, regardless of the size or position of the InnerCanvas, to position it there.
My first pass was this
privatevoid setupNowLine(double distanceToMove = 0)
// Get the left of the inner container
double left = Canvas.GetLeft(innerCanvas);
if (distanceToMove == 0)
distanceToMove = left - originalInnerCanvasLeft;
// Recalulcate the new position
nowLinePosition = (INNER_CANVAS_WIDTH + distanceToMove) - NOW_LINE_POSITION;
// Position the Now line
But it doesn't work. For the life of me I can't get the calculations right. I could use some help here.
I am working on WPF app and got stucked on below items, any help would be greatly appreciated.
1) I am using usercontrol (do not want to use window) and want to stop resizing of it but cannot see any property. please help me in achieving the same.
2) I have a Grid having rowdefinitions and columndefinitions which is containing multiple button inside it. my task is whenever i am setting the visibility of any button to false that cell space should get released and next button should overcome this position.
Sorry , my bad , actually i alter this to set as an example and forget to change the value. Yes you're correct it should be 1. so , bascally i am having 2,2 grid with buttons on every cell. Now please suggest how can i use collapsed property on cell . Thanks
So if I am correct in understanding, you have a UserControl that is a button that you want to place in Grid.Row 2. Judging by the HorizontalAlignment="Left" and the Vertical Alignment="Center", this button is going to be placed in this grid along with some other control and you want them aligned and not to resize?
1) Grid.Row="0" is the first row, Grid.Row="1" would be the second row, and since there are only 2 rows defined in the definition, I think the first step is to make it Grid.Row="1". Also, If there is nothing in Grid.Row="0" then the Auto deceleration would essentially be empty, and no space taken up.
2) VerticalAlignment="Center" and HorizontalAlignment="Left" are not going to be valid unless there are other controls inside this grid along with the usercontrol, otherwise the Auto will size the width and height to the control. Having said that, if there is indeed another control that is taller and wider than this control, inside the same grid space, then indeed this would need to be set. Also, if there is more than one control you will need some kind of arrangement control such as a StackPanel to place them. For example:
Next I am guessing you have a property bound to the visibility that changes the visibility of your button; however, just to illustrate my point, if you were to set the visibility property to collapsed, the space should release. Such as:
Hope this is what you were looking for! Again I am making a few assumptions, so if I am not answering what you are asking, if you could be more specific I would be happy to continue to try and assist you!
Thanks for your time to look into my problem and come up with above solution. Unfortuantely this is not what i am looking for , as i have replied to kerry :
i am having 2,2 size grid holding buttons on all cell, when i make any of the button invisible , i want to release that cell space but collapsed not working here . i hope you got my problem now.
Ok, yes I think I understand a little better now, so you have a 2 x 2 grid, each has a button in it. When one of those buttons is set to collapsed you want the grid space to be released. Here is the solution I have come up with.
Thank you, this did help me to get a visual of what you are trying to accomplish. I still have one question and that is, the only buttons that you want to change the visibility on are the 8 buttons in the middle of your control correct? Under that assumption I have come up with a solution that I believe meets your requirements.
I made a User Control with the design height at 500 and the design width at 300 which allowed me to fit all your controls in the window and keep the same arrangement scheme that you provided.
Next, I created 3 rows and seperated your controls into the 3 Sections. The top controls will go in the first StackPanel like this:
The WrapPanel is where I host your 8 buttons, and the StackPanels will host your other controls.
Save To Draft
Lowest Height Control
Send for QC
Maintain Scheme Checklist
Configure Storey Heights
This WrapPanel will cause your controls to take up the space that the collapsed button used to occupy and will move up rows if there is enough space on the row above it. The width of the WrapPanel will determine how many buttons per row as the buttons will fill in horizontally before moving down to the next row, this is possibly the reason for the vertical alignment you previously mentioned.
And Finally You can put your Last Section in another StackPanel:
//m_windowUI.MaximumSize = new System.Drawing.Size(305, 500);
This will only set the maximum size of the element host so that you can not size it any larger than this size. The same rule will apply to MinimumSize, it will not size any smaller than that size.
m_windowUI.Size = new System.Drawing.Size(305,500);
is the event that I believe you are looking for. It has been a while since I worked with windows forms, but I believe when you set the size of a control it will not resize when the window does.
I suppose you could set a minimum and maximum that are the same size, but the real thing to understand here is that both the user control and the element host inherit from Control, so they should both be thought of as controls inside a window.
Again it has been a while since I worked with Windows.Forms, but I will create a little dummy project and see if I can't find a solution, but hopefully these suggestions might get you on the right track.
If you could help me get a visual of what I need to recreate... Windows.Forms Window, element host, then WPF UserControl. The UserControl is in the element host that is docked inside a window with other winforms controls? or is the usercontrol hosted by itself inside the window?