How to get instance of Panel that holds content of ItemsControl?

It’s a little tricky since you don’t know the name of the Panel so you can’t use FindName etc. This will work for most cases where an ItemsPresenter is present private Panel GetItemsPanel(DependencyObject itemsControl) { ItemsPresenter itemsPresenter = GetVisualChild<ItemsPresenter>(itemsControl); Panel itemsPanel = VisualTreeHelper.GetChild(itemsPresenter, 0) as Panel; return itemsPanel; } An implementation of GetVisualChild private static … Read more

IE & Firefox – custom drop down could not remove native arrows

Use this it will work but with IE10+ and for FF : Your css should look like this: select.desktopDropDown::-ms-expand { display: none; } More about ::ms-expand. Then for the rest : select.desktopDropDown { outline : none; overflow : hidden; text-indent : 0.01px; text-overflow : ”; background : url(“../img/assets/arrow.png”) no-repeat right #666; -webkit-appearance: none; -moz-appearance: none; … Read more

Custom UITableViewCell programmatically using Swift

Let’s make a few assumptions: You have an iOS8 project with a Storyboard that contains a single UITableViewController. Its tableView has a unique prototype UITableViewCell with custom style and identifier: “cell”. The UITableViewController will be linked to Class TableViewController, the cell will be linked to Class CustomTableViewCell. You will then be able to set the … Read more

ASP.NET Custom Control – Unknown server tag

When adding a namespace, I’ve found I also need the assembly. If your assembly is also myApplication do this in web.config: <add tagPrefix=”one” namespace=”myApplication.Controls” assembly=”myApplication”/> Then, just clean and rebuild and it should all work. Once this is in your web.config, you don’t need to add it to your page unless you’re using this in … Read more

How to make a Scroll Listener for WebView in Android

Something like: public class ObservableWebView extends WebView { private OnScrollChangedCallback mOnScrollChangedCallback; public ObservableWebView(final Context context) { super(context); } public ObservableWebView(final Context context, final AttributeSet attrs) { super(context, attrs); } public ObservableWebView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); } @Override protected void onScrollChanged(final int l, final int t, final int … Read more

How to set a custom view’s intrinsic content size in Swift?

Setting the intrinsic content size of a custom view lets auto layout know how big that view would like to be. In order to set it, you need to override intrinsicContentSize. override var intrinsicContentSize: CGSize { return CGSize(width: x, height: y) } Then call invalidateIntrinsicContentSize() Whenever your custom view’s intrinsic content size changes and the … Read more

How to make an expandable/collapsable section widget in Qt

I stumbled upon the same problem and solved it by implementing the collapsible widget as a QScrollArea whose maximum height is animated by a QPropertyAnimation. But since I don’t use QDesigner, I can’t tell you if it works there. I still have one problem: Instead of only expanding towards the bottom direction, the collapsible widget … Read more

tech