项目是用MVVM模式开发:
public List<TabItem> tabItemsList = new List<TabItem>();
public TabControl tabDynamic = null;
tabDynamic = queryControl.GetChildObject<System.Windows.Controls.TabControl>(layOut, "tabDynamic"); //获取TabControl 控件
public void AddTabItem(string uriName)
int count = tabItemsList.Count;
// create new tab item
TabItem tab = new TabItem();
tab.Header = string.Format("Tab {0}", uriName.Split('/')[1]);
tab.Name = string.Format("tab{0}", uriName.Split('/')[1]);
tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
//tab.Background = new SolidColorBrush(Colors.Transparent);
//tab.MouseDoubleClick += new MouseButtonEventHandler(tab_MouseDoubleClick);
Uri MainTragetUri = new Uri(string.Format("/Freed.Api.Monitor;component/View/{0}.xaml", uriName), UriKind.RelativeOrAbsolute);
Frame frame = new Frame();
frame.Name = "frameMaim";
frame.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
frame.JournalOwnership = System.Windows.Navigation.JournalOwnership.UsesParentJournal;
frame.Source = MainTragetUri;
tab.Content = frame;
// insert tab item right before the last (+) tab item
var tabOld = (from t in tabItemsList where t.Name == tab.Name select t).FirstOrDefault();
if (tabOld == null)
if (count > 0)
tabItemsList.Insert(count - 1, tab);
tabItemsList.Add(tab);
tabDynamic.SelectedItem = tab;
tabDynamic.SelectedItem = tabOld;
XAML代码:
<TabControl Grid.Column="1" Background="Transparent" x:Name="tabDynamic" ItemsSource="{Binding}" Margin="-2,-1,2,1">
<TabControl.Resources>
<DataTemplate x:Key="TabHeader" DataType="TabItem">
<DockPanel>
<Button Name="btnDelete" Command="{Binding DataContext.DeleteTabItemClickCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" DockPanel.Dock="Right" Margin="5,0,0,0" Padding="0" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=Name}">
<Image Source="/Images/关闭 (1).png" Height="11" Width="11"></Image>
</Button>
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=TabItem }, Path=Header}"/>
</DockPanel>
</DataTemplate>
</TabControl.Resources>
</TabControl>
量的积累,才会有质的飞越!
最近这段时间一直在研究微服务架构,在实际操作中却遇到了一个困扰我整整大半个月的一个大坑,就是在本地测试时Ocelot请求接口正常,但是到我把接口部署服务器时却一直请求接口失败,提示无法匹配下游路由;如下图所示:Consul服务如下图所示:Ocelot配置信息如下图所示:因为这个问题我整整在网上找了大半个月的资料,却没有找到一个正确的解决方法,正当我准备放弃时却无意间一位博主提到了:“当服务和 Consul 在同一台电脑上时,Ocelot 最终变换成 http://hostname:port/ur
Coravel是一个专为.NET Core设计的.NET Standard库,除了任务调度,还提供了像队列、缓存、邮件等其它高级功能。特点就是对开发者十分友好,接入十分简单、优雅、流畅,接近于零配置
index_mode自定义索引名cn_name表名car_mode列名1.创建普通索引SQL CREATE INDEX 语法在表上创建一个简单的索引。允许使用重复的值:注释:“column_name” 规定需要索引的列。2.创建唯一索引SQL CREATE UNIQUE INDEX 语法在表上创建一个唯一的索引。唯一的索引意味着两个行不能拥有相同的索引值。3.实例CREATE INDEX 实例本例会创建一个简单的索引,名为 “PersonIndex”,在 Person 表的 Las
项目场景:NewLift.Core-NewLift.Log使用使用描述 解决方案:提示:代码实现:using NewLife.Log;using System;namespace NewLifePro{ class Program { static void Main(string[] args) { XTrace.UseConsole(); XTrace.WriteLin.
[HttpGet("DownloadTemplate")] [AllowAnonymous] public async Task<dynamic> DownloadTemplate([FromQuery] EnumBackgroundConfig Config) { if (!Enum.IsDefined(typeof(EnumBackgroundConfig), (int)Config)) { .
select a.id,a.Title,a.Receiver,a.IsRead,a.NotificationMethod,a.Creation_id,a.CreationTime,b.DeptName,c.CompanyName,(case when a.IsRead >0 then '已阅读' else '未读' end) as ReadStatus from [dbo].[res_Knowledge_MessagePush] a left join res_Knowledge_Pers.