小编IBR*_*BRA的帖子

Android:没有操作栏的Swipey标签

我创造了一个ViewPager.我想添加可滚动的标签(swipey标签),使其更灵活(如谷歌播放).以及我发现使用的所有教程ActionBar.我怎么能不使用ActionBar

android android-viewpager android-scrollable-tabs

10
推荐指数
1
解决办法
6205
查看次数

使用AvalonDock 2.0时未处理的'System.ComponentModel.Win32Exception'

我正在使用AvalonDock 2.0,当我打开一个dock容器时,在调试模式下应用程序崩溃(它在没有调试的情况下运行时工作正常).我得到以下异常:

WindowsBase.dll中发生了未处理的"System.ComponentModel.Win32Exception"类型异常

附加信息:操作成功完成

我遇到了这个答案,建议取消选中"例外设置"中的框.有线的事情是它第一次使用它.但它不再存在了.我试过其他机器也不行.任何有关如何解决此问题的建议.
Avalon代码(第5行引发的异常)

protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
            if (msg == Win32Helper.WM_WINDOWPOSCHANGING) {
                if (_internalHost_ContentRendered) {
                    // the below line throw the exception
                    Win32Helper.SetWindowPos(_internalHwndSource.Handle, Win32Helper.HWND_TOP, 0, 0, 0, 0, Win32Helper.SetWindowPosFlags.IgnoreMove | Win32Helper.SetWindowPosFlags.IgnoreResize);
                }
            }
            return base.WndProc(hwnd, msg, wParam, lParam, ref handled);
        }
Run Code Online (Sandbox Code Playgroud)

c# wpf exception win32exception avalondock

7
推荐指数
1
解决办法
3376
查看次数

如何处理ComboBox的SelectedIndexChanged事件?

我有DataGridViewComboBox列.第二个ComboBox将填充数据,具体取决于第一个选定的值ComboBox.

如何处理第一个SelectedIndexChanged事件ComboBox.

c# combobox datagridview event-handling winforms

5
推荐指数
2
解决办法
4万
查看次数

应用程序启动时启动servlet

我想在加载jsp页面之前启动servlet类,因为我需要在jsp页面中填充数据库中的一些数据.web.xml中的Servlet映射

    <servlet>
        <servlet-name>Index</servlet-name>
        <servlet-class>com.Teklabz.Servlets.IndexServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Index</servlet-name>
        <url-pattern>/index</url-pattern>
    </servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

但它没有用,当跟踪代码时它永远不会到达servlet类.另外我试图像这个链接一样使用ServletContextListener ,但我遇到了同样的问题.

监听代码:

public class ServletListener implements ServletContextListener{

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
Run Code Online (Sandbox Code Playgroud)

web.xml代码:

    <listener>
        <listener-class>com.techlabz.listener.ServletListener</listener-class>
    </listener>
Run Code Online (Sandbox Code Playgroud)

我不知道做错了什么.

java web.xml servlets servlet-listeners

5
推荐指数
1
解决办法
4060
查看次数

将任意数字格式化为三位数?

我想将用户输入的任何数字插入数据库,如三位数.

例如,如果用户插入(1)我想将号码保存为(001),或者将(20)保存为(020).

注意:数据库列的数据类型是字符串而不是整数.

c# string-formatting

3
推荐指数
1
解决办法
1万
查看次数

错误消息仅显示错误消息中的第一个字符。INotifyDataErrorInfo WPF

当 TextBox 为空时,我有一个简单的验证来显示错误消息。问题在于消息只显示消息的第一个字母。

在此处输入图片说明

在文本框样式中:

<Trigger Property="Validation.HasError" Value="True">
    <Setter Property="ToolTip" Value="{Binding Path=(Validation.Errors)[0].ErrorContent, RelativeSource={x:Static RelativeSource.Self}}" />
</Trigger>
Run Code Online (Sandbox Code Playgroud)

如果我将错误消息直接设置为 Setter 值,它会毫无问题地显示所有内容。

<Trigger Property="Validation.HasError" Value="True">
    <Setter Property="ToolTip" Value="This field is required!" />
</Trigger>
Run Code Online (Sandbox Code Playgroud)

XAML 代码:

<TextBox Text="{Binding Name, Mode=TwoWay,
                UpdateSourceTrigger=PropertyChanged, 
                ValidatesOnNotifyDataErrors=True,
                NotifyOnValidationError=True}" />
Run Code Online (Sandbox Code Playgroud)

C# 代码

private readonly Dictionary<string, string> _errors = new Dictionary<string, string>();
private readonly object _lock = new object();
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;

public IEnumerable GetErrors(string propertyName)
{
    string errorsForName;
    lock (_lock)
    {
        errorsForName = _errors.FirstOrDefault(e => e.Key == propertyName).Value;//.TryGetValue(propertyName, …
Run Code Online (Sandbox Code Playgroud)

c# wpf inotifydataerrorinfo wpf-style

3
推荐指数
1
解决办法
392
查看次数

在java中隐藏选项卡标题

我有Tabbed Pane三个标签。如何隐藏这些选项卡的标题以防止用户按下它们?

我曾经通过c#创建一个从选项卡组件类继承的类,然后重写隐藏选项卡的方法来做到这一点,但最近我切换到java,我搜索了很多,但没有得到任何结果。

java swing tabs

1
推荐指数
1
解决办法
3598
查看次数

使用Prism - WPF关闭动态添加的Tab项

我正在使用Prism RegionManager,用一个TabControl区域注册不同的视图MainView.

MainView.xaml

    <TabControl regions:RegionManager.RegionName="MainViewTabRegion">
        <TabControl.ItemTemplate>
            <DataTemplate>
                <DockPanel Width="Auto">
                    <Button Command="{Binding DataContext.DataContext.CloseTabCommand, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}"
                            CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}"
                            Content="X"
                            Cursor="Hand"
                            DockPanel.Dock="Right"
                            Focusable="False"
                            FontFamily="Courier"
                            FontWeight="Bold"
                            Margin="4,0,0,0"
                            FontSize="10"
                            VerticalContentAlignment="Center"
                            Width="15" Height="15" />

                            <ContentPresenter Content="{Binding DataContext.DataContext.HeaderText, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" />
                 </DockPanel>
             </DataTemplate>
        </TabControl.ItemTemplate>
    </TabControl>
Run Code Online (Sandbox Code Playgroud)

在MainViewViewModel中,我使用相同的基类添加不同的视图.

MainViewViewModel.cs:

private void AddProjectView() {
     var view = _container.Resolve<ProjectSettingsView>();
     var dataContext = _container.Resolve<ProjectSettingsViewModel>();
     dataContext.HeaderText = "test header txt";
     view.DataContext = dataContext;
     _regionManager.RegisterViewWithRegion("MainViewTabRegion", () => view);
}
Run Code Online (Sandbox Code Playgroud)

我可以在视图中添加新的标签项.

我怎样才能关闭标签项目中,<TabControl.ItemTemplate>在上面的XAML代码,添加了一个关闭按钮与CloseCommand中 …

c# wpf tabcontrol prism mvvm

1
推荐指数
1
解决办法
973
查看次数