2017-08-18 12 views
-1

私はHTMLコンテンツを含む文字列を持っています。Webブラウザのボタンサイズを動的に変更します

string str = "<html><head><meta http-equiv='Content-Type'content='text/html;charset=UTF-8'><style>.containt-box{position:relative; margin-top:-10px;}h3{color:#000000;font-size: 14px;}h5.plainText{color:#000000;font : 14px;}ul.b{liststyletype:square;position: relative;bottom: 0px;}li{font-size : 14px;}.containt-box p{color:#000000;}a:link{color:#ff6600;font-size: 14px;}p{color:#000000;font-size: 14px;}a.button{background-color: #ff6600;border: none;color: white;padding: 10px 15px;text-align:center;textdecoration: none;display: block;font-size: 16px;margin: 0 auto;width: 40%;}</style><script>function setAppFont(fontFamily) { document.body.style.fontFamily = fontFamily; }</script></head><body><a href=\"http://www.google.com" class=\"button\">Learn more</a></body></html>" 

この文字列は、ウェブブラウザ

XAML

<phone:WebBrowser x:Name="DescriptionBrowser" Grid.Row="1" Grid.RowSpan="2" Navigating="DescriptionBrowser_Navigating" Margin="0,15,0,0"/> 

<TextBlock x:Name="ErrorBlock" Visibility="Collapsed" Foreground="Black" FontSize="20" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Segoe UI"/> 

C#

if (string.IsNullOrEmpty(str)) 
     { 
      ErrorBlock.Visibility = System.Windows.Visibility.Visible; 
     } 
     else 
     { 
      DescriptionBrowser.NavigateToString(str); 
      ErrorBlock.Visibility = System.Windows.Visibility.Collapsed; 
     } 
に表示されます

私の質問は、C#コードでstrに存在するこのリンクの幅のサイズを大きくしたいのですが。

<a href=\"http://www.google.com" class=\"button\">Learn more</a> 

何か助けていただければ幸いです。

答えて

0

説明が紛らわしいように見えますが。

あなたは簡単にブートストラップ Buttonクラスを設定することによって、これを達成することができます。 あなたがディナミカルに変更する必要がある場合は、javascriptを使用して、現在のcllassを下記のクラスに変更することができます。

ブロックレベルのボタンを作成します。ブロックレベルのボタンは、.btnブロッククラスを追加することで、親の全幅に及ぶボタンを作成します。

あなたは.btn-lgクラスを追加して長いボタンを作成します。

関連する問題