NuGetからmaterialdesigncolorsとmaterialdesignthemesをインストールしました。問題のコードは一番下に記述しています.
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" MaterialDesignfloatingActionMiniAccentbutton
のところで
リソース "MaterialDesignFloatingActionMiniAccentButton" を解決できません。
とエラーが起きます。下のコードのようにStaticResourceの HeaderStylex:keyに定義されているような記述があるはずなのですが、元のサンプルコードを見渡しても全く記述されているところが見当たりません。
<Window x:Class="WpfTutorialSamples.Styles.ExplicitStyleSample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ExplicitStyleSample" Height="150" Width="300"> <Window.Resources> <Style x:Key="HeaderStyle" TargetType="TextBlock"> <Setter Property="Foreground" Value="Gray" /> <Setter Property="FontSize" Value="24" /> </Style> </Window.Resources> <StackPanel Margin="10"> <TextBlock>Header 1</TextBlock> <TextBlock Style="{StaticResource HeaderStyle}">Header 2</TextBlock> <TextBlock>Header 3</TextBlock> </StackPanel> </Window>
##問題のコード
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid Grid.ColumnSpan ="2" Background ="#FF8522BD"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Width="25" Height="25" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White"> <materialDesign:PackIcon Kind="Bell"/> </Button> <Button Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}" Width="25" Height="25" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White"> <materialDesign:PackIcon Kind="Account"/> </Button> <Button Width="25" Height="25"> <materialDesign:PackIcon Kind="Power" Width="25" Height="25" Background="{x:Null}" BorderBrush="{x:Null}"></materialDesign:PackIcon> </Button> </StackPanel> </Grid> </Grid>

回答1件
あなたの回答
tips
プレビュー