macOS SwiftUI Navigation for a Single View

Here is a simple demo of possible approach for custom navigation-like solution. Tested with Xcode 11.4 / macOS 10.15.4 Note: background colors are used for better visibility. struct ContentView: View { @State private var show = false var body: some View { VStack{ if !show { RootView(show: $show) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.blue) .transition(AnyTransition.move(edge: .leading)).animation(.default) … Read more

Bootstrap 4 responsive navbar vertical

For Bootstrap 4, the breakpoints have changed. You should override the navbar CSS like this if you want it to be vertical on small screens: @media(max-width: 544px) { .navbar .navbar-nav>.nav-item { float: none; margin-left: .1rem; } .navbar .navbar-nav { float:none !important; } .navbar .collapse.in, .navbar .collapsing { clear:both; } } Demo http://codeply.com/go/Ar1H2G4JVH Note: The @media … Read more

How to programmatically navigate WPF UI element tab stops?

You do that using MoveFocus as shown in this MSDN article which explains everything about focus: Focus Overview. Here is some sample code to get to the next focused element (got it from that article, slightly modified). // MoveFocus takes a TraversalRequest as its argument. TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Next); // Gets the element with … Read more

WPF Tab Key Navigation

WPF treats the entire UI Tree as a single Tab scope. It isn’t broken up into smaller areas such as you would expect. This includes controls inside UserControls. For example, if you had <StackPanel> <TextBox Name=”TextBox1″ /> <MyUserControl /> <TextBox Name=”TextBox3″ /> </StackPanel> And MyUserControl looked like <MyUserControl> <TextBox Name=”TextBox2″ /> </MyUserControl> The default tab … Read more

SwiftUI 2: the way to open view in new window

Update: Xcode 14 / macOS 13 Now we can explicitly open needed window giving it identifier and use it in openWindow environment action. class BookViewModel: ObservableObject {} class AppState: ObservableObject { @Published var selectedBook: BookViewModel? } @main struct SwiftUI2_MacApp: App { @StateObject var appState = AppState() @SceneBuilder var body: some Scene { WindowGroup { // … Read more