์โฆ์ผ๋จโฆ์ฌ์ง์ ์ฌ๋ฆฌ๋ ค๊ณ ํ๋๋ฐโฆ์ฌ์ง์ ์ด๋ป๊ฒ ์ฌ๋ ค์ผ ํ๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
'|------------------------------|
'| item1 |
'| item2 |
'| item3 |
'|------------------------------|
์์ ๊ฐ์ด ์๋๋ฐ,
<Style x:Key="FontSelectorListBox" TargetType="ListBox" BasedOn="{StaticResource ListBoxBase}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="FontSize" Value="20"/>
</Style>
</Setter.Value>
</Setter>
</Style>
Style์ ์ด์ ๊ฐ์ด ๋ง๋ค์์ต๋๋ค.
๋น์ฐํ Style=โ{StaticResource FontSelectorListBox}โ ์ ๊ฐ์ด Style์ ์ง์ ํด ์คฌ๊ตฌ์.
๊ทธ๋ฐ๋ฐโฆFontSize๊ฐ ๋ณ๊ฒฝ์ด ๋์ง ์์ต๋๋ค.
ํน์ ๋ญ๊ฐ ๋ฌธ์ ์ธ์ง ์ข ๋ด์ฃผ์ค๋ถ ์๊ณ์ ๊ฐ์?
์ ๋ง ๋์๋ฒ๋ฆฌ๊ฒ ์ต๋๋ค. ๋ถํ ๋๋ฆฝ๋๋ค.
al6uiz
2
ListBoxBase ์คํ์ผ ๋ฆฌ์์ค์ ์ ์๋ ์ด๋ป๊ฒ ๋๋์? ํด๋น ์คํ์ผ์์ ItemTemplate ์์ฑ์ ์ง์ ํ์ผ๋ฉฐ, ๊ทธ ์์์ FontSize ์์ฑ์ ์ง์
- ๋๋ ์ด
FontSelectorListBox ์คํ์ผ์ ์ฌ์ฉํ๋ ListBox์์ ItemTemplate ์์ฑ์ ์ง์ ํ์ผ๋ฉฐ, ๊ทธ ์์์ FontSize ์์ฑ์ ์ง์
๋ ์ค ํ๋์ด์ง ์์๊น ํ๋ ์ถ์ธก์ ํด๋ด
๋๋ค.
1 Like
์ ๋ list view ์ฐ๋๋ฐ GridViewColumnHeader๋ฅผ TargetType์ผ๋ก ์ก๊ณ ํฐํธ ์กฐ์ ํ๊ณ listview์ ItemContainerStyle=โ{StaticResource CustomListViewItemStyle}โ ์ด๋ ๊ฒ ๋ฃ์ด์ ์ฐ๊ณ ์๋ค์
1 Like
์ผ๋จ ์ด๋ ๊ฒ ํด๊ฒฐ ํ์ต๋๋ค.
XAMLํ์ผ์์ ์ด๋ ๊ฒ ํ๊ตฌ์โฆ
<ListBox x:Name="FontListBox" ItemsSource="{Binding Fonts}" SelectedItem="{Binding SelectedFont, Mode=TwoWay}" Grid.Row="1" Grid.Column="0" Style="{StaticResource FontSelectorListBox}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontFamily="{Binding FontFamilly}" Style="{StaticResource FontSelectorTextBlock}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
๊ทธ๋ฆฌ๊ณ Style ํ์ผ์์ ์ด๋ ๊ฒ ํ์ต๋๋ค.
<Style x:Key="FontSelectorTextBlock" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBase}">
<Setter Property="FontSize" Value="36"/>
</Style>
์ด๊ฒ ์ ์์ ์ธ ๋ฐฉ๋ฒ์ธ์ง๋ ๋ชจ๋ฅด๊ฒ ์ง๋งโฆ ์ด๋ ๊ฒ ๋ชฉ์ ์ ์ด๋ค์ต๋๋ค.
1 Like