How to create custom window chrome in wpf?

You set your Window’s WindowStyle=”None”, then build your own window interface. You need to build in your own Min/Max/Close/Drag event handlers, but Resizing is still maintained. For example: <Window WindowState=”Maximized” WindowStyle=”None” WindowStartupLocation=”CenterScreen” MaxWidth=”{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}” MaxHeight=”{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}” > <DockPanel x:Name=”RootWindow”> <DockPanel x:Name=”TitleBar” DockPanel.Dock=”Top”> <Button x:Name=”CloseButton” Content=”X” Click=”CloseButton_Click” DockPanel.Dock=”Right” /> <Button x:Name=”MaxButton” Content=”Restore” … Read more

window.open() on a multi-monitor/dual-monitor system – where does window pop up?

Result of “window.open dual-screen” search revealed this fancy nugget: Dual Monitors and Window.open “When the user clicks on a link that opens a new window using window.open. Make the window appear on the same monitor as its’ parent.” // Find Left Boundry of the Screen/Monitor function FindLeftScreenBoundry() { // Check if the window is off … Read more

jquery – keep window from changing scroll position while prepending items to a list?

Store a reference to the first message before you prepend new messages, and after you prepend, set the scroll to the offset of that message: $(document).on(‘scroll’, function() { var scroll = $(document).scrollTop(); if (scroll < 1) { // Store eference to first message var firstMsg = $(‘.message:first’); // Prepend new message here (I’m just cloning…) … Read more

How do I get the offset().top value of an element without using jQuery?

use getBoundingClientRect if $el is the actual DOM object: var top = $el.getBoundingClientRect().top; JSFiddle Fiddle will show that this will get the same value that jquery’s offset top will give you Edit: as mentioned in comments this does not account for scrolled content, below is the code that jQuery uses https://github.com/jquery/jquery/blob/master/src/offset.js (5/13/2015) offset: function( options … Read more

How to restore a minimized Window in code-behind?

Not sure this will work for everybody, but I ran into this today and someone on the team suggested “have you tried Normal“? Turns out he was right. The following seems to nicely restore your window: if (myWindow.WindowState == WindowState.Minimized) myWindow.WindowState = WindowState.Normal; That works just fine, restoring the window to Maximized if needed. It … Read more

AngularJS $watch window resize inside directive

You shouldn’t need a $watch. Just bind to resize event on window: DEMO ‘use strict’; var app = angular.module(‘plunker’, []); app.directive(‘myDirective’, [‘$window’, function ($window) { return { link: link, restrict: ‘E’, template: ‘<div>window size: {{width}}px</div>’ }; function link(scope, element, attrs){ scope.width = $window.innerWidth; angular.element($window).bind(‘resize’, function(){ scope.width = $window.innerWidth; // manuall $digest required as resize event … Read more

jQuery window scroll event does not fire up

Your CSS is actually setting the rest of the document to not show overflow therefore the document itself isn’t scrolling. The easiest fix for this is bind the event to the thing that is scrolling, which in your case is div#page. So its easy as changing: $(document).scroll(function() { // OR $(window).scroll(function() { didScroll = true; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)