问题是:
托管此最低功能代码时,在导航或刷新页面时,表单上的第一个按钮会以蓝色内边框突出显示。从控件中删除边框会完全删除内边框,但是我们需要边框位于控件上。
好的,这将是一个很糟糕的,所以我将发布两个项目的整个最低功能代码,一个MVC和一个WPF ...
〜/查看/共享/ _Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<style>
.scrollUp, .scrollDown {
width: 110px;
height: 110px;
background-color: black;
border-radius: 55px;
color: white;
font-size: 1.6em;
background: linear-gradient(120deg, #404040, black);
}
</style>
</head>
<body>
@RenderBody()
@RenderSection("footer", false)
<button class="scrollUp">Page<br />Up</button>
<button class="scrollDown">Page Down</button>
</body>
</html>
〜/查看/主页/ Index.cshtml
@{
ViewBag.Title = "Kiosk Online Ordering";
}
Birds
〜/控制器/主页/ HomeController.cs
using System.Web.Mvc;
namespace Kiosk.Web.Controllers
{
public class HomeController : Controller
{
public ViewResult Index()
{
return View();
}
}
}
观看/ MainWindowView.xaml
<Window x:Class="Store.Kiosk.Views.MainWindowView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:Store.Kiosk.ViewModels"
mc:Ignorable="d"
Title="MainWindow" Height="1024" Width="1280" d:DataContext="{d:DesignInstance viewModels:DesignKioskWebBrowserViewModel, IsDesignTimeCreatable=True}"
ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen">
<ContentControl Content="{Binding WebBrowserControl}"/>
</Window>
查看/ MainWindowView.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using Store.Kiosk.Services;
using Store.Kiosk.ViewModels;
namespace Store.Kiosk.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindowView : Window
{
private IWebKioskConfigurationService _webKioskConfigurationService;
public MainWindowView()
{
_webKioskConfigurationService = new WebKioskConfigurationService();
//_webKioskConfigurationService = webKioskConfigurationService;
DataContext = new KioskWebBrowserViewModel
{
WebBrowserControl = new WebBrowser { Source = _webKioskConfigurationService.GetDefaultUri() }
};
InitializeComponent();
}
}
}
的ViewModels / DesignKioskWebBrowserViewModel.cs
using System;
using System.Windows.Controls;
namespace KK.Store.Kiosk.Standalone.ViewModels
{
// ReSharper disable ClassNeverInstantiated.Global
public class DesignKioskWebBrowserViewModel : KioskWebBrowserViewModel
// ReSharper restore ClassNeverInstantiated.Global
{
public DesignKioskWebBrowserViewModel()
{
WebBrowserControl = new WebBrowser { Source = new Uri("http://www.google.com", UriKind.Absolute) };
}
}
}
的ViewModels / KioskWebBrowserViewModel.cs
using System;
using System.Windows.Controls;
using Store.Kiosk.ViewModels;
namespace Store.Kiosk.ViewModels
{
public class KioskWebBrowserViewModel : ViewModelBase
{
public KioskWebBrowserViewModel()
{
}
private WebBrowser _webBrowserControl;
public WebBrowser WebBrowserControl
{
get { return _webBrowserControl; }
set { SetValue(ref _webBrowserControl, value); }
}
}
}
的ViewModels / ViewModelBase.cs
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Store.Kiosk.ViewModels
{
public abstract class ViewModelBase : INotifyPropertyChanged, IDisposable
{
public event PropertyChangedEventHandler PropertyChanged;
private bool _isVisible = true;
public bool IsVisible
{
get { return _isVisible; }
set { SetValue(ref _isVisible, value); }
}
[STAThread]
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
[STAThread]
~ViewModelBase()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing)
{
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
protected void SetValue<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(value, field)) return;
field = value;
OnPropertyChanged(propertyName);
}
}
}
服务/ IWebKioskConfigurationService.cs
using System;
namespace Store.Kiosk.Services
{
public interface IWebKioskConfigurationService
{
Uri GetDefaultUri();
}
}
服务/ WebKioskConfigurationService.cs
using System;
namespace Store.Kiosk.Services
{
public class WebKioskConfigurationService : IWebKioskConfigurationService
{
public Uri GetDefaultUri()
{
return new Uri("http://localhost/{YourKioskWebsiteUrl}", UriKind.Absolute);
}
}
}
因此,如果您在没有兼容模式的情况下安装了IE9 +,则会产生两个按钮,一个具有蓝色内边框。我尝试删除边框:hover,:active,:focus,:: - moz-focus-inner,它们似乎都不起作用。只要我将边框重新添加到按钮,蓝色内边框就会返回。是否有人熟悉这个问题?
我正在运行IE11