8,735
社区成员
发帖
与我相关
我的任务
分享
StringBuilder strStyle = new StringBuilder();
strStyle.Append("<Style xmlns='http://schemas.microsoft.com/client/2007' xmlns:sdk='http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' x:Key=\"STYLE_DATAGRIDCELL\" TargetType=\"sdk:DataGridCell\"> ");
strStyle.Append(" <Setter Property=\"Foreground\" Value=\"Blue\" /> ");
strStyle.Append(" <Setter Property=\"Cursor\" Value=\"Hand\"></Setter> ");
strStyle.Append(" <Setter Property=\"Template\" > ");
strStyle.Append(" <Setter.Value> ");
strStyle.Append(" <ControlTemplate> ");
strStyle.Append(" <TextBlock x:Name=\"UrlTextName\" VerticalAlignment=\"Center\" Tag=\"{Binding}\" Text=\"{Binding " + name + "}\" /> ");
strStyle.Append(" </ControlTemplate> ");
strStyle.Append(" </Setter.Value> ");
strStyle.Append(" </Setter> ");
strStyle.Append("</Style> ");
Style style = (Style)XamlReader.Load(strStyle.ToString());