Visibility Data Binding does not fire on initial page load

4 posts, 0 answers
  1. mark
    mark avatar
    6 posts
    Member since:
    Jul 2011

    Posted 22 May 2012 Link to this post

    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.
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 23 May 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Dave Baumann
    Dave Baumann avatar
    6 posts
    Member since:
    Mar 2010

    Posted 07 Nov 2012 Link to this post

    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
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 12 Nov 2012 Link to this post

    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.
Back to Top