Click here to Skip to main content
13,251,760 members (92,892 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
How to convert this xaml in c# code ?

<Style x:Key="TileStyle" TargetType="control:Tile">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="control:Tile">
                <Image Source="{Binding Path=ImgSource, RelativeSource={RelativeSource TemplatedParent}}"></Image>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Posted 23-Jan-13 1:33am
Updated 30-Jun-17 11:31am
Comments
d@nish 23-Jan-13 7:01am
   
Did you try something?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

<Style TargetType="{x:Type Primitives:RowSelectorHeaderCellControl}" x:Key="Test">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate >
                        <Button Background="YellowGreen" Content="ColChooser" Name="button1"  Click="button1_Click" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Please check the answers suggested in Converting ControlTemplate XAML to C#[^].

Thanks...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

<?xml version="1.0" encoding="utf-8"?>
<Window x:Class="DiceBot.Views.MainWindow" Title="DICE BOT by BashkaMen" Width="900" Height="500" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:converter="clr-namespace:DiceBot.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:local="clr-namespace:DiceBot.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:media="clr-namespace:System.Windows.Media;assembly=PresentationCore" xmlns:viewmodels="clr-namespace:DiceBot.ViewModels">
<window.datacontext>
<viewmodels:MainViewModel />

<window.resources>

&lt;Setter Property="FrameworkElement.Margin" Value="3" />
&lt;Setter Property="FrameworkElement.HorizontalAlignment" Value="Center" />
&lt;Setter Property="TextBlock.FontWeight" Value="UltraLight" />


&lt;Setter Property="FrameworkElement.Margin" Value="3" />
&lt;Setter Property="Control.VerticalContentAlignment" Value="Center" />


&lt;Setter Property="FrameworkElement.Margin" Value="3" />
&lt;Setter Property="Control.VerticalContentAlignment" Value="Center" />


&lt;Setter Property="FrameworkElement.Margin" Value="3" />
&lt;Setter Property="Control.FontWeight" Value="UltraLight" />
&lt;Setter Property="TextBox.TextAlignment" Value="Center" />

<converter:BoolToColor x:Key="boolToColor" />
<converter:BoolToResult x:Key="boolToResult" />

<grid>
<grid.rowdefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="*" />

<Grid Grid.Row="0" Grid.RowSpan="2">
<grid.columndefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="170" />
<ColumnDefinition Width="*" />

<GroupBox Header="Аккаунт">
<stackpanel>
<TextBlock Text="Зеркало" />
<TextBox TextAlignment="Center" Text="{Binding Mirror}" />
<GroupBox Header="Регистрация">
<stackpanel>
<TextBlock Text="Логин" />
<TextBox Text="{Binding Register.Login, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="Пароль" />
<TextBox Text="{Binding Register.Password, UpdateSourceTrigger=PropertyChanged}" />
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 30 Jun 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100