This is a migrated thread and some comments may be shown as answers.

Visibility Data Binding does not fire on initial page load

3 Answers 71 Views
HubTile
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mark
Top achievements
Rank 1
mark asked on 22 May 2012, 09:50 PM
Very weird behavior I am experiencing. I databind the visibility property of two tiles such that I only show one or the other. The first time the page loads, the tile that is initially set to false/Collapsed will never display until I navigate away and come back. However, the tile that is initially set to true/Visible can come and go as he pleases.

UPDATE: I got around this by setting the properties that I bind the two tile's visibility to as TRUE initially. That way they are immediately 'visible' and then after I get my service response I update with the real value. It works but I would feel better if the Visibility property worked the way it should.

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 23 May 2012, 08:32 AM
Hi Mark,

 Thanks for writing.
I am afraid that with the information provided I am not able to determine what the issue may be. The Visibility property is a member of UIElement and we have no control over it, the Silverlight framework does. Could you send a sample app that demonstrates the issue so that I may debug it?
I am looking forward to your reply.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dave Baumann
Top achievements
Rank 1
answered on 07 Nov 2012, 08:32 AM
I am seeing the same issue as Mark. I have a HubTile that I only want to display if a certain value is true. I have the HubTile in a RadWrapPanel for layout. As Mark says, if the initial Visibility setting for the HubTile is Collapsed the only way to get it to display is to change it to visible and then navigate away and back to the page again. I am seeing that it is receiving the updated Visibility value and even tried setting it manually to no avail. I have the October version of the WP7 controls.

To Reproduce.
  1. Create a new Windows Phone 7 project in Visual Studio 2010 that uses MVVM (preferably not Caiburn Micro).
  2. Add a secondary page and a way to navigate to it from the main page of the application.
  3. Add a RadWrapPanel to the MainPage. 
  4. Add a RadHubTile and bind the visibility to a property in the ViewModel that is initially set to false (using the BooleanToVisibilityConverter). You can set the fallback value in the binding to whatever you wish.
  5. Toggle the Visibility setting. You will not see the tile
  6. Navigate to another page and then come back to the main page. Now the tile will be visible (assuming your property holds it's state).

If you add other built-in wp7 controls to a RadWrapPanel you will notice that they toggle their visibility as expected. If you have a RadHubTile sitting in a grid (LayoutRoot, for example) toggling the visibility for that will work as well.

Edit: It looks like if you place the RadHubTile within a Grid (with the Grid being the child of the RadWrapPanel) that the visibility behavior works as expected.

Thanks,

Dave
0
Victor
Telerik team
answered on 12 Nov 2012, 02:19 PM
Hello Dave,

It appears that this is a bug in Silverlight. I managed to reproduce the bug with a minimum amount of code. The problem seems to emerge when you put a control inside a custom panel. Please have a look at the attached demo application. If you uncomment the button inside the grid everything works as expected. However, if you use the the button in the custom panel, nothing is drawn on screen when the visibility changes. This happens because, for unknown reasons, the control template is not applied when a control is inside the custom panel.

I am afraid that there is nothing we can do our side to fix this.
Thank you for understanding.

Regards,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
HubTile
Asked by
mark
Top achievements
Rank 1
Answers by
Victor
Telerik team
Dave Baumann
Top achievements
Rank 1
Share this question
or