-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FluidWrapPanel Automatic layout problem #3
Comments
Could you provide more detail about your issue? |
@ratishphilip When I switch the position of the child controls, they are not filled with the entire container |
@dandanyouxiang You have to write your own logic to resize them. Check my blog for more details. |
@ratishphilip thanks,I do not automatically change the size of its children.I just want to change their position.But they don't fill the container after the adjustment |
@ratishphilip Could you give me a Email,I want to send you two pictures to show you the results。I split this FluidWrapPanel three rows and three columns,A large child occupy two rows and two columns,Five small child each occupy one line and one column,When I have exchange of their location, the big will run out of the FluidWrapPanel ,I want to kown why?Look forward to your reply |
Can you please share your images on OneDrive or though any image sharing site? |
@ratishphilip I want to upload a png but "Something went really wrong, and we can’t process that file." |
@ratishphilip I used a wpf project |
@dandanyouxiang I sent you the WPF version to your mail id You can send me your images to 2233475@guerrillamail.com. |
@ratishphilip I have sent you a Email please check |
@dandanyouxiang
var brush = _brushes[_random.Next(_brushes.Length)];
//var factor = 1;
var factorWidth = UseRandomChildSize ? _random.Next(1, 3) : 1;
var factorHeight = UseRandomChildSize ? _random.Next(1, 3) : 1;
var factorWidth = 1;
var factorHeight = 1;
if (i ==0)
{
panel.ItemWidth = commWidth * 2;
panel.ItemHeight = commHeight * 2;
}
else
{
panel.ItemWidth = commWidth * 1;
panel.ItemHeight = commHeight * 1;
}
var ctrl = new FluidItemControl
{
ClipToBounds=true,
Width = factorWidth * panel.ItemWidth,
Height = factorHeight * panel.ItemHeight,
Fill = brush,
Data = (i + 1).ToString()
};
ctrl.SetValue(Panel.ZIndexProperty, 2);
items.Add(ctrl); Here if The correct code should be private void RefreshFluidWrapPanel()
{
var items = new ObservableCollection<UIElement>();
var count = 6;
for (var i = 0; i < count; i++)
{
var brush = _brushes[_random.Next(_brushes.Length)];
var factorWidth = 1;
var factorHeight = 1;
if (i ==0)
{
factorWidth = 2;
factorHeight = 2;
}
var ctrl = new FluidItemControl
{
ClipToBounds=true,
Width = factorWidth * panel.ItemWidth,
Height = factorHeight * panel.ItemHeight,
Fill = brush,
Data = (i + 1).ToString()
};
ctrl.SetValue(Panel.ZIndexProperty, 2);
items.Add(ctrl);
}
panel.ItemsSource = items;
} If you do these two changes, your panel shall work as expected. |
Here is the corrected code |
@ratishphilip can you give send email ,I can not download this “”CusPanel.zip” |
@ratishphilip I tried your way ,but do not work; |
I sent it via mail to 2896232010@qq.com |
@ratishphilip I was to divide the window into three rows and three columns.Let them stained with the whole window,not you give me |
Ok. I am able to reproduce your issue here. This might require some change in the FluidWrapPanel logic. I am looking into it. |
thank you,Look forward to your reply |
@dandanyouxiang I have updated the Layout logic of FluidWrapPanel with a more robust code. Do try it. It should now work as per your requirement. P.S. : I have updated the Target DotNetFramework to 4.6.2. So you may have to retarget your project to 4.6.2 too. |
I tested no problem.Thank you |
You are welcome! |
@ratishphilip I want to say that you write well |
@dandanyouxiang Thank you very much. |
I want to know why he didn't fill the entire parent window after I had been dragged.
The text was updated successfully, but these errors were encountered: