I am working on a site where I have an accordian control for the main content and in each is another accordian control. It worked fine so long as there were just a few items in there but once I got enough items in the child accordian they are clipped when expanding an item. It's not so bad for items near the top of the list but for items near the end you cannot see anything because it's completely clipped.
You can see them if you collapse the main accordian control and then expand it again. (see http://www.utahcodecamp.com/#Sessions/ to see what I mean)
Any suggestions? Can I force the parent accordian item to re-calculate the size?
It looks like you may have found a bug in the Accordian implementation. You should create a very small spike with just enough in it to reproduce the problem and post it to the issues section for the Silverlight Toolkit.
I found a work-around. It works perfectly!
"a" is the inner accordian.
void a_SizeChanged(object sender, SizeChangedEventArgs e)
{
var accordian = sender as AccordionItem;
var items = accordian.GetVisualAncestors();
foreach (DependencyObject obj in items)
{
if (obj is ExpandableContentControl)
{
ExpandableContentControl ctrl = obj as ExpandableContentControl;
ctrl.Height += e.NewSize.Height - e.PreviousSize.Height;
}
}
}
Related
I'm trying to add a Grid into a VerticalLayoutContainer of fixed size (250 px) and have the user be able to scroll vertically.
I'm using the following code, however, the grid does not display at all.
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
vPanel.setHeight("250px");
vPanel.add(grid, new VerticalLayoutData(1, 1));
grid.setHeight("auto");
add(vPanel);
The Grid displays in other circumstances, but covers up other GUI elements (no scrollbar).
Hopefully this is an easy fix for those more experienced with Sencha GXT.
Thanks to anyone taking the time to help me out...
try this:
vPanel.getScrollSupport().setScrollMode(ScrollMode.auto);
If it doesn't work, then, try this:
`
ContentPanel p = new ContentPanel();
p.setHeaderVisable(false);
p.setBodyBorder(false);
p.setBorder(false);
p.setHeigh(250);
vPanel.add(p);
p.add(grid);
`
then grid, will automaticaly have scroll mode.
I had the same problem with a Grid in a ContentPanel, that is, the grid didn't show a vertical scrollbar. I used ContentPanel#forceLayout immediately after adding the grid to the panel, and it resolved the problem. Here's the actual code:
Grid<Pet> grid = new Grid<>(listStore, columnModel);
grid.setBorders(true);
grid.setColumnReordering(true);
grid.setLoadMask(true);
grid.setSelectionModel(selectionModel);
grid.setView(createGridView());
ContentPanel contentPanel = new ContentPanel();
contentPanel.setHeaderVisible(false);
contentPanel.add(grid);
contentPanel.forceLayout(); // <---- this is the line that fixed the problem!
I am using following code to set gray light effect on window when I open a popup. It works fine but it basically reloads all controls or refreshes the main window .
Especially this line: currentWindow.Content = lightboxGrid;
Window currentWindow = Application.Current.Windows.Cast<Window>()
.SingleOrDefault(x => x.Name.Equals(MAIN_WINDOW_NAME));
Grid lightboxGrid = new Grid();
object currentWindowContent = currentWindow.Content;
currentWindow.Content = null;
lightboxGrid.Children.Add(new ContentControl()
{
Content = currentWindowContent
});
// now add the grid that will "black out" the content
Grid blackoutGrid = new Grid();
blackoutGrid.Background = new SolidColorBrush(Colors.Black);
lightboxGrid.Children.Add(blackoutGrid);
blackoutGrid.Opacity = 0.0; // start fully transparent
blackoutGrid.Loaded += blackoutGrid_Loaded;
currentWindow.Content = lightboxGrid;
this._lightboxEffectApplied = true;
What could be the option to have the same effect without refreshing the main window or reloading the controls?
If your main window has a Grid as its layout root (even if all the content is in the first cell), then you could add this blackoutGrid as a child to that grid and it will display above the other elements without messing with the original visual tree structure.
In this case, the Content of your Window would be a Grid, and you would add your blackoutGrid to that Grid, and remove it when you are done.
The way you are writing this seems to be a little against object-oriented practice. Technically it should be your Main Window that has the ability to display a lightbox effect.
I'm developing a reporting dashboard application using W8 Metro UI style application. The application has a dark theme, so most of the screen is black. I'm using the WebView control to display SSRS .rdl reports from our report server (which all have black backgrounds). The problem I'm seeing is that when I navigate to a new report, the WebView control flashes white for a split second and then loads the new report. To get around this, I tried putting an Easing opacity animation on the WebView control to make it fade out, load the report, and then fade back in. However, no matter what I try, I can't get the flickering to go away.
I then tried putting a black rectangle on top of the WebView and fading that one in and out... still no luck. The WebView is always on top at runtime, meaning I can't put any control on top of it. Does anyone know of a way around this?
I breifly looked into the WebView.Transitions, but couldn't find many resources on this. Could this be my answer?
EDIT:
Event to load the new report:
void ItemListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Create a WebViewBrush of the content currently loaded in the WebView
WebViewBrush b = new WebViewBrush();
b.SourceName = "WebView1";
b.Redraw();
Rectangle1.Fill = b;
// Hide the WebView
WebView1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
// Navigate to the new report
var selectedItem = ItemListView.SelectedItem;
WebView1.Navigate(((Report)selectedItem).ReportUri);
}
void WebView1_LoadCompleted(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e)
{
// Show the new report
WebView1.Visibility = Windows.UI.Xaml.Visibility.Visible;
Rectangle1.Fill = new SolidColorBrush(Colors.Transparent);
}
This is just the way WebView works because internally its loading the trident COM control into a separate hwnd. The workaround is to set Visibility to Hidden on the webview and instead show a webviewbrush which isn't interactive but does integrate with the rest of your UI so it can be animated, etc
i have a window with grid panel as the content...
when the window first shown, my store is empty and i can't see the scrorllbar (good)
when i load the data to store, i can see the scrollbar (good)
when i remove all data from store, i can still see the scrollbar and scrollable. when exactly there's no data in view (bad)
so my question is my title, how to remove scrollbar after datastore removed
here is the demo
Its is a open bug. Sencha team promises to fix it it 4.0.7. Have a look at this discussion at Sencha forum.
One possible solution given in the forum, is to hide the scrollbar using hideVerticalScroller() method. I did try it on fiddle but was not successful 100% (may be something to do with fiddle). I had to click "remove data" button twice to remove the scroll bar:
handler:function(){
storeSr.removeAll();
gridSr.hideVerticalScroller();
}
On the forum, they suggest doing (And this works!):
storeSr.removeAll();
var data = [];
var store = gridSr.getStore();
store.loadData(data, false);
if (data.length == 0) {
gridSr.hideVerticalScroller();
}
How can I set the horizontal scroll position of a list box in code? I have a list box with a wrap panel in the items template and I want to implement a 'page right' function that behaves like a page down down in a normal list but works sideways.
Thanks!
With some more searching around the site, I figured out the answer to my question.
Using the following function from Josh G's answer to this question
public static childItem FindVisualChild<childItem>(DependencyObject obj)
{
...
}
With that function to page left and right via code, this is all you have to do is the following (where listBox is the name of my ListBox control),
void PageRight()
{
ScrollViewer myScrollviewer = FindVisualChild<ScrollViewer>(listBox);
myScrollviewer.PageRight();
}
You can use the ScrollIntoView method to scroll a specific item into view