Hello,
I'm using the XamWebDialogWindow as a modal popup.
I've got a few teething issues with it.
1) The scrollbars don't appear if the content is "dynamically" resized.
My dialog contains a user control that contains a XamWebGrid and I bind data to it. When the data is bound, the grid becomes bigger and doesn't fit anymore. The dialog doesn't show the scrollbars.
If I "hardcode" the content, the scrollbars appear as expected
2) Dialog not resized to fit content.
I expect the dialog to fit itself to its content. Once again, that happens with "hardcoded" data in the XamWebGrid but not with bound data.
3) (Don't know if it's related) The XamWebGrid in the dialog fits all the width available and makes the dialog take all the available width. I'd like it to fit to data and it doesn't seem to work in that instance (code copy-pasted from other control and it shows the expected behaviour).
Cheers.
Hi bjunk!
If you want to have a scrollbars you can put the content od the XamWebDialogWIndow inside a ScrollViewer:
<igWindow:XamWebDialogWindow Width="200" Height ="200">
If you didn't specify size of the window (Width and Height) - window will be resized to show all content:
<igWindow:XamWebDialogWindow >
<Button Width="300" Height="300" Content="Content"/>
</igWindow:XamWebDialogWindow>
Id dynamically change the size of the XamWebDialogWindow content you can listen to
SizeChanged ebent of the content element.
For example:
XAML:
C#
this
.myBtn.SizeChanged += new SizeChangedEventHandler(MyBtn_SizeChanged);
void MyBtn_SizeChanged(object sender, SizeChangedEventArgs e)
{
myWin.Height += (e.NewSize.Height - e.PreviousSize.Height);
myWin.Width += (e.NewSize.Width - e.PreviousSize.Width);
}
This approach can work with other UI components, uncluding Grid
I hope this can help :-)
Kind Regards!
Mihail
(I'm using another account but I'm the original sender of the post).
1) That's what I've done. My point was: why do I have to do that? It happens automatically if I don't use binding! I don't have to do that for other containers neither!
Isn't it a bug in the DialogWindow?
2) Shouldn't that also happen automatically? The other containers behave that way AFAIK, it's just the DialogWindow that wants to be special.
Isn't it a bug also? Maybe related to the 1st one?
Hi,
I gave up on using the XamWebDialogWindow because I didn't manage to get a correct behaviour from it. Now I've got to use it again and after more testing, it turns out it's really broken from my point of view.
I can't get the decent behaviour that I get from the other built-in components.
I'm using Prism and I stick a Grid in a XamWebDialogWindow. If I set the grid's size to static, then it works fine (as I said in the previous entries).
If I set some of the rows/columns to "Auto", then the dialog doesn't resize.
If I use a ContentControl rather than the XamWebDialogWindow, I get exactly what I want (the whole grid appears). If I use the XamWebDialogWindow it doesn't resize.
I tried your suggestion of hooking up the resize event but although that works fine with the ContentControl, it throws an exception when I do it with the XamWebDialogWindow. Did you actually try this yourself or just assumed it would work?
Can you suggest any other way? To me, the component is broken if there's no way to allow it to dynamically resize to fits its content.
I'm using the latest Silverlight plugin, latest service release.
Hi R4cOOn
Could you send mi example with your code plese?
Then it will be possible to suggest the better way in that case.
Thanks!
I managed to create a solution that shows the problem.
I have different controls in the main page. What I want the XamWebDialogWindow to do is behave like the ContentControl (click on the "ContentControl" button). When clicking on the "Grow" button, the control resizes iteself.
The other controls are XamWebDialogWindow that are created dynamically or not.
Please note that when I set the content at creation time the dialog has the right size but then doesn't resize.
If I add the content dynamically, it doesn't resize itself at all.
If I hook up the resize event of the child, then it crashes (last example).
Let ne know if it's possible for the XamWebDialogWindow to have the same behaviour as the ContentControl in my small example. That's the only thing I want to do.
Hi R4cOOn,
I just want to clarify one thing - is it application where you use a Prism framework and you have different modules or not?
Kind regards!
Yes, I do have different modules.
However, in the example I sent you there is no PRISM framework.
Thanks for the reply but that's definitely NOT the issue I was describing in the posts and the files I sent.
What I wants is set up the DialogWindow as a region and dynamically set data to it. So in your example, you'll need to set the Shell as a Grid with a XamWebDialogWindow inside as a region and then stick ModuleB's view inside it.
I couldn't get that part to work because:
1) the XamWebDialog wouldn't resize itself to fit the content
2) hooking up the content's SizeChanged event and changing the size of the XamWebDialogWindow makes it crash.
As I stated before, the issues that I described have NOTHING to do with my use of PRISM but everything to do with dynamically sizing the XamWebDialogWindow.
Did you have a look at the sample that I sent? Does it crash for you as well?
I attached a sample with DialogWondow and Prism that works properly.
I modified one well known sample with Prism
http://development-guides.silverbaylabs.org/Video/Silverlight-Prism#videolocation_6
I have added also Module ModuleB with XamWebDialogWIndow and have modified SamplePrism silverlight application project. Modified files are attached to my post. Please download the original sample, modify it and start it .
Best Wishes!
Tomorrow has gone. Any news?
I hope that for tomorrow you will have an answer.
Kind Regards,
I'd like to know if you can provide some informations.
Is it a bug? Am I doing something wrong?
Can I achieve the behaviour that I'm after?