Skip to content

Commit a86a132

Browse files
committed
updated
1 parent 5fc5a83 commit a86a132

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

wpf/Button/Getting-Started.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ The [IconTemplate](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.C
315315
mc:Ignorable="d"
316316
Title="MainWindow" Height="450" Width="800">
317317
<Window.DataContext>
318-
<local:Model/>
318+
<local:ViewModel/>
319319
</Window.DataContext>
320320
<Window.Resources>
321321
<DataTemplate x:Key="checkedIcon">
@@ -344,12 +344,12 @@ The [IconTemplate](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.C
344344
Stretch="Fill" />
345345
</Grid>
346346
</DataTemplate>
347-
<local:IconTemplateSelector x:Key="IconTemp" CheckedIcon="{StaticResource checkedIcon}" UnCheckedIcon="{StaticResource unCheckedIcon}"/>
347+
<local:IconTemplateSelector x:Key="IconTemplateSelector" CheckedIcon="{StaticResource checkedIcon}" UnCheckedIcon="{StaticResource unCheckedIcon}"/>
348348
</Window.Resources>
349349
<Grid>
350350
<StackPanel VerticalAlignment="Center">
351351
<CheckBox Name="Check" IsChecked="{Binding IsChecked,Mode=TwoWay}" HorizontalAlignment="Center" Content="ChangeIcon"/>
352-
<syncfusion:ButtonAdv x:Name="button" HorizontalAlignment="Center" Margin="10" Label="IconTemplateSelector" IconTemplateSelector="{StaticResource IconTemp}" DataContext="{Binding IsChecked}"/>
352+
<syncfusion:ButtonAdv x:Name="button" HorizontalAlignment="Center" Margin="10" Label="IconTemplateSelector" IconTemplateSelector="{StaticResource IconTemplateSelector}" DataContext="{Binding IsChecked}"/>
353353
</StackPanel>
354354
</Grid>
355355
</Window>
@@ -361,9 +361,8 @@ The [IconTemplate](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.C
361361
public class ViewModel : INotifyPropertyChanged
362362
{
363363
private bool _isChecked;
364-
public event PropertyChangedEventHandler PropertyChanged;
365364
public bool IsChecked
366-
{
365+
{
367366
get { return _isChecked; }
368367
set
369368
{
@@ -375,6 +374,8 @@ The [IconTemplate](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.C
375374
}
376375
}
377376
377+
378+
public event PropertyChangedEventHandler PropertyChanged;
378379
protected void OnPropertyChanged(string propertyName) =>
379380
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
380381
}
@@ -384,23 +385,20 @@ The [IconTemplate](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.C
384385
public DataTemplate CheckedIcon { get; set; }
385386
public DataTemplate UnCheckedIcon { get; set; }
386387
public override DataTemplate SelectTemplate(object item, DependencyObject container)
387-
{
388+
{
388389
if (item is bool isChecked)
389390
{
390391
return isChecked ? CheckedIcon : UnCheckedIcon;
391392
}
392393
return base.SelectTemplate(item, container);
393-
}
394+
}
394395
}
395396

396397
{% endhighlight %}
397398

398399
{% endtabs %}
399400

400-
![Setting Image](Getting-Started_images/Getting-Started_img13.png)
401-
402-
![Setting Image](Getting-Started_images/Getting-Started_img14.png)
403-
401+
![IconTemplateSelector in WPF Button](Getting-Started_images/Getting-Started_IconTemplateSelector.gif)
404402

405403
N> The [ButtonAdv](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.ButtonAdv.html) loads the icon in the following priority order.
406404
* [IconTemplateSelector](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.ButtonAdv.html#Syncfusion_Windows_Tools_Controls_ButtonAdv_IconTemplateSelector)
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)