Posts
Showing posts with the label Tips
CSS Tips: min-content, max-content, fit-content - intrinsic sizing with CSS
- Get link
- X
- Other Apps
Remove default Bing Map Layer from the WPF-MapControl
- Get link
- X
- Other Apps
When providing your own tiles to the Map Control in WPF you would want to remove the default map being served by Bing behind your own source. This is the "full" XAML block from one of my example projects: <m:Map Center="48.03,-122.4" Name="MyMap" CredentialsProvider="YOUR-BINGMAP-KEY" ZoomLevel="10"> <m:Map.Mode> <!-- set empty map mode to remove default map layer --> <m:MercatorMode /> </m:Map.Mode> <!-- Included for completeness, but to be replaced by yor own code or wait for a post about this --> <!-- <local:MyTileLayer x:Name="WebMapLayer" UriFormat="{Binding SelectedTileProvider.UriFormat}"> <m:MapItemsControl ItemsSource="{Binding Places}"> <ItemsControl.ItemTemplate> <DataTemplate> <m:PushPin ...
Styling code in Blogger posts
- Get link
- X
- Other Apps
On this plattform (Blogger) I wanted to style the code blocks. I found one javascript formatter called highlight.js, and it can be found on this link: https://highlightjs.org/ . To implement this I had to go to the admin-part. Select the menu [Themes], and under the selected theme it is a button named [Edit Html]. And in the window with the hml-code I paste in the following in the <head> section: <script src='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js'/> <link href='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles//vs.min.css' rel='stylesheet'/> <script>hljs.initHighlightingOnLoad();</script> In line 2 you can change vs.min.css with other styles like github.min.css or the darker vs2015.min.css or ocean.min.css . This will apply style to all the <pre><code>//nnnn</code></pre> . For this blog theme I have added an override style in [themes] [Cu...
Tip to enable key-events in WPF
- Get link
- X
- Other Apps
Working on a project with editing shapes I came over a problem when I wanted to canced the operation when the user pressed the escape-key. When I added an event handler for KeyPress or KeyDown or even PreviewKeyDown it never fired. This was because the graphical elements didn't actully have focus. For my user-control for the graphic element I solved this by adding this in the constructor: this.Focusable = true; this.FocusVisualStyle = null; The second line ensured that the dotted focus-rectangle also disseapeared. For a xaml-based approach this is the markup: <Canvas Focusable="True" FocusVisualStyle="{x:Null}"> <!-- The shapes or elements like an elipse, rectangle, path or stack-panel... --> </Canvas>